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.