Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Right-to-left cursor positioned funny
Message
 
À
13/02/2003 14:49:37
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00598335
Message ID:
00767889
Vues:
34
>Hi Tom,
>Are you still there?
>
>Can you tell me how you "autmoatically switching to the Arabic IME when I get to the field"?
>
>>>Has anyone worked with Arabic characters mixed with English on the same form?
>>>
>>>I have a few text fields on my form (and in my tables) that are in Arabic. I can do lots of neat stuff, like storing and displaying Arabic characters, making the field right-justified, and autmoatically switching to the Arabic IME when I get to the field.

--------
Hi David. Sorry I didn't see your reply sooner.

I have a property of my subclassed textbox called InputLocaleId. In the GetFocus() event I put:
*** Activate keyboard for language specified
if !empty(this.InputLocaleId)
	goSysAPI.ActivateKeyboardLayout (this.InputLocaleId)
endif
In my lost focus I do the opposite:
*** Restore original keyboard
if !empty(this.InputLocaleId)
	goSysAPI.ActivateKeyboardLayout ()
endif
Now you need to look at my goSysAPI.ActivateKeyboardLayout() method:
procedure ActivateKeyboardLayout (pcInputLocaleID)
*** Saves the current input locale, and sets the new one.

*** If no pcLocalId passed, restore previous layout.
*   Pass hex code as letters and numbers.
*   Leading 0s are supplied automatically.

*** Here are some common language IDs.  See Foxpro.H for more.
* 409 = EN = English (United States)
* C0C = FR = French (Canada) - Canadian Multilingual Standard
* 1401 = AR = Arabic (Algeria) - Arabic (102)
* 11009 = EN = English (Canada) - Canadian Multilingual Standard

local lnN, lnHandle, lcInputLocaleID

if !" LoadKeyboardLayout " $ this.RegisteredAPIs
	*** Register DLLs
	declare integer GetKeyboardLayout ;
			in User32 ;
			integer lnThreadId
	declare integer LoadKeyboardLayout ;
			in User32 ;
			string @lpctInputLocalIndentifier, ;
			integer Flags
	declare integer ActivateKeyboardLayout ;
			in User32 ;
			integer lnHandle, ;
			integer Flags

	this.RegisteredAPIs = this.RegisteredAPIs + ;
				"GetKeyboardLayout LoadKeyboardLayout ActivateKeyboardLayout "
endif

if empty(pcInputLocaleId)
	*** Restore previous locale
	ActivateKeyboardLayout (this.PrevInputLocaleHandle, 0)
else
	*** Save current keyboard layout for restoring
	this.PrevInputLocaleHandle = GetKeyboardLayout (0)

	*** Set/Load new locale
	lcInputLocaleID = padl(pcInputLocaleID, 8, "0")

	*** Look for a handle to this language
	lnN = ascan(this.aInputLocales, lcInputLocaleID, 1, -1, 1, 8)
	if lnN = 0
		*** Not found. First time for this language.  Load it.
		#define KLF_ACTIVATE        0x00000001
		#define KLF_SUBSTITUTE_OK   0x00000002
		lnHandle = LoadKeyboardLayout (lcInputLocaleId, ;
					KLF_ACTIVATE + KLF_SUBSTITUTE_OK)
		*** Save handle for future use
		do Addrow with this, "aInputLocales", lcInputLocaleId, lnHandle
	else
		*** We already have a handle for this language.  Just activate it.
		ActivateKeyboardLayout (this.aInputLocales[lnN,2], 0)
	endif
endif

return
This may be a bit fancier than you need, but the guts are there.
Hope it helps.
Tom Green in Montreal
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform