TXBrowse:bKeyChar for UTF8 is capture incorrect. *Fixed*

TXBrowse:bKeyChar for UTF8 is capture incorrect. *Fixed*

Postby dutch » Thu Feb 28, 2019 6:01 am

Dear Master,

I use TXbrowse:bKeyChar and type 1 character. ::bKeyChar:= {|nKey| }, nKey is capture 1 character. I type "ไ" but nKey = 3652.
I need to show what the user type for searching but I cannot display correct character.
How do I show correctly character?

Code: Select all  Expand view
*------------------------*
Function PickGst( nFolio )
local oDlgs, oSay, oSay2, oBtn
local lChk := .F.
local cQuery, aJoins, cFields

Private FindKey, RS

FindKey := ''

if !empty(aRecNo)

    cQuery := "tbl_status='O' and tbl_id<>"+strim(MEMVAR->oTBL:tbl_id)
    cFields:= "*"
   
    RS := OPENDB('fotbl_cashier',cFields,cQuery,'tbl_rmno',,,0)

   DEFINE DIALOG oDlgs RESOURCE 'TRANSF' ;
         COLOR CLR_BLACK,   THEME2007 ;
         FONT MEMVAR->oFont

   oDlgs:lHelpIcon := .F.
   
   REDEFINE SAY oSay2 PROMPT TE(1604,'พิมพ์ เลขห้อง หรือชื่อสกุล','Type Room No. or Last Name') ID 200 OF oDlgs
   REDEFINE SAY oSay2 PROMPT TE(0159,'ค้นหา','Search') ID 202 OF oDlgs
   REDEFINE SAY oSay PROMPT MEMVAR->FindKey ID 102 OF oDlgs

   REDEFINE XBROWSE oBrw COLUMNS "tbl_rmno", ;
                                        "TRANS(tbl_chk,'@Z 99')", ;
                                        "tbl_last", ;
                                        "dtoc(tbl_arr)", ;
                                        "dtoc(tbl_dep)", ;
                                        "tbl_rmk" ;
                            HEADERS  TE(0206,'ห้อง','Room#'), ;
                                        TE(0454,'โฟลิโอ','Fol#'), ;
                                        TE(0220,'ชื่อแขก','Last name'), ;
                                        TE(0017,'วันเข้า','Arrival'), ;
                                        TE(0233,'วันออก','Departure'), ;
                                        TE(0209,'หมายเหตุ','Remarks') ;
                            FIELDSIZES 70, 40, 150, 70, 70, 300  ;
                            DATASOURCE RS ;
                            AUTOSORT ;
                            UPDATE ;
                            ID 101 ;
                            OF oDlgs ; //                           ON CHANGE ( oSay:settext( FindKey ) ,oSay:refresh() ) ;
                            ON DBLCLICK ( Transfer(RS:TBL_INTNO, RS:TBL_RMNO, nFolio) , oDlgs:End() )

   xBrStyles( oBrw, .T. )
   
    oBrw:bKeyChar       := { |nKey| (FindRm(nKey,oSay), oSay:Refresh()) }
   oBrw:bKeyDown       := { |nKey| iif(nKey=VK_RETURN, (Transfer(RS:TBL_INTNO, RS:TBL_RMNO, nFolio),oDlgs:End()) ,) }

   REDEFINE SBUTTON oBtn ID 11 OF oDlgs ;
            RESOURCE 'OK4' ;
            PROMPT TE(0438,'ตกลง','&OK') ;
            ACTION (Transfer(RS:TBL_INTNO, RS:TBL_RMNO, nFolio), oDlgs:End()) ;
             COLOR bSColors W97 ;
             TEXT ON_RIGHT

   ACTIVATE DIALOG oDlgs ON INIT (oDlgs:Move( 227,463 ), oBrw:SetFocus()) RESIZE16

    CLOSEDB('RS')

else
    MsgStop(TE(0448,'กรุณาเลือกรายการก่อนย้ายรายการ','Please Select (Mark) before MOVE Transaction'))
end 
return lChk

*--------------------------------------*
Function FindRm(nKey,oSay)

?nKey

if nKey == VK_BACK
   if len(MEMVAR->FindKey) >= 1
      MEMVAR->FindKey := left(MEMVAR->FindKey,len(MEMVAR->FindKey)-1)
   end
else
   MEMVAR->FindKey += upper(chr(nKey))
end
oSay:SetText(MEMVAR->FindKey)

oSay:Refresh()
return .T.
 
Last edited by dutch on Fri Mar 01, 2019 3:46 am, edited 1 time in total.
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: TXBrowse:bKeyChar for UTF8 is capture incorrect.

Postby nageswaragunupudi » Thu Feb 28, 2019 7:48 pm

My advice that you do not try to show it yourself. You may not be able to do it correctly, Instead, leave it to xbrowse. Xbrowse shows it correctly.

Use @ r, c SAY oBrw:oSeek VAR oBrw:cSeek .........
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: TXBrowse:bKeyChar for UTF8 is capture incorrect.

Postby dutch » Fri Mar 01, 2019 2:00 am

Dear Master,

It works great, it is more easier and reduce the code also.

Thank you so much.
nageswaragunupudi wrote:My advice that you do not try to show it yourself. You may not be able to do it correctly, Instead, leave it to xbrowse. Xbrowse shows it correctly.

Use @ r, c SAY oBrw:oSeek VAR oBrw:cSeek .........
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 60 guests