Author | Topic: Right To Left | |
---|---|---|
Moshe Yarden | Right To Left on Sun, 06 Mar 2011 16:45:42 +0200 Hello, During migration of a clipper application to xBase++ (text mode) I faced a need to replace a standart GET reader command, getting the input from Left to Right with a new GET reader command (for Hebrew) getting the input from Right to Left. I need: 1. To toogle between languages: to sent a ctrl-shift or alt-shift ascii code to the keyboard. I couldn't find the ascii codes for such combination. 2. To move the cursor to the right side of the input field. I'm using: oGet:end(). It is working. 3. To move the cursor one position from right to left after each Hebrew keystroke or space bar: ascii 128 to 154, and ascii 32. I'm using: oGet:pos := Len( oGet:buffer ) - (i++). It is working, but not very elegant. 4. Toggling back to English or numbers should use the standard GET reader. Any help would be appreciated. Regards, Moshe Yarden | |
Peter Alderliesten | Re: Right To Left on Mon, 07 Mar 2011 09:33:49 +0100 Moshe, > 1. To toogle between languages: to sent a ctrl-shift or alt-shift ascii code > to the keyboard. > I couldn't find the ascii codes for such combination. I don't think these keys send scan codes by themselves. You can query the state of these keys however (with appKeyState()) in your event loop after you checked for regular events. Peter | |
AUGE_OHR | Re: Right To Left on Mon, 07 Mar 2011 17:30:49 +0100 hi, > During migration of a clipper application to xBase++ (text mode) I faced a > need to replace a standart GET reader command, getting the input from Left > to Right i do not think tha GET can do it. switch to XbpSLE > 1. To toogle between languages: to sent a ctrl-shift or alt-shift ascii > code to the keyboard. > I couldn't find the ascii codes for such combination. hm ... perhaps this help nCountry := GetKeyboardLanguage() ******************************************** FUNCTION GetKeyboardLanguage() LOCAL nLayout := DllCall( "user32.dll", DLL_STDCALL, "GetKeyboardLayout", 0 ) RETURN bAnd( nLayout, 0xFFFF ) PROCEDURE ChangeKeyboard(cAction) LOCAL aTest := {} LOCAL aWahl := {} LOCAL nChoice := 0 LOCAL i,iMax DEFAULT cAction TO "" atest := GetKeyboardList() iMax := LEN(atest) FOR i := 1 TO iMax AADD(aWahl, STR( bAnd(atest[i], 0xFFFF )) ) NEXT IF ID_CHINA Chinese / English IF EMPTY(cAction) nChoice := ASCAN( aWahl,{|x| x =="1033"} ) English IF nChoice > 0 ActivateKeyboardLayout(atest[nChoice]) ENDIF ELSE nChoice := ASCAN( aWahl,{|x| x =="2052"} ) Chinese RPC IF nChoice > 0 ActivateKeyboardLayout(atest[nChoice]) ENDIF ENDIF ELSE Chinese / German IF EMPTY(cAction) nChoice := ASCAN( aWahl,{|x| x =="1031"} ) German IF nChoice > 0 ActivateKeyboardLayout(atest[nChoice]) ENDIF ELSE nChoice := ASCAN( aWahl,{|x| x =="2052"} ) Chinese RPC IF nChoice > 0 ActivateKeyboardLayout(atest[nChoice]) ENDIF ENDIF ENDIF RETURN Function GetKeyboardList() local cBuffer:=Space(4), nEntries, i, aRetArray:={} nEntries:=DllCall("User32.dll",DLL_STDCALL,"GetKeyboardLayoutList", 1, @cBuffer) cBuffer:=Replicate(Chr(32), nEntries*4) DllCall("User32.dll",DLL_STDCALL,"GetKeyboardLayoutList", 1, @cBuffer) For i:=1 to nEntries AAdd(aRetArray, Bin2L(SubStr(cBuffer,((i-1)*4)+1,4))) * AAdd(aRetArray,STR( bAnd(Bin2L(SubStr(cBuffer,((i-1)*4)+1,4)), 0xFFFF ))) next i return aRetArray *Then you can pass any of the keyboard IDs returned in the array to: Function ActivateKeyboardLayout(nLayout) RETURN If(DllCall("User32.dll",DLL_STDCALL,"ActivateKeyboardLayout", nLayout)==0,.f.,.t.) ******************************************** greetings by OHR Jimmy |