Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

switch input field to write a different language

switch input field to write a different language

switch input field to write a different language

hello everybody,
I have this simple form which have some input fields.
the case is I have first field to input english name and the second field to input arabic name.

now the user name has to switch the language to input the arabic field by pressing the suitable hot keys.

Is there a way to switch to the required language without pressing the hot keys?

Iam using windows XP proffessional, clarin 6.3

THank you in advance.

RE: switch input field to write a different language


I assume you are talking about the language of the keyboard. I am not that knowledgeable about it but if changing the character set will help you could set the font & character set for that TEXT/ENTRY control.

If that does not work ::

On EVENT:Selected of the Arabic control ::


  ?<ArabicColumnName>{PROP:Touched} = True ! this will force an EVENT:Accepted for the control every time you exit this control

  SYSTEM{PROP:CharSet} = CHARSET:Arabic  ! 178

On EVENT:Accepted of the Arabic control ::


  SYSTEM{PROP:CharSet} = CHARSET:Ansi  ! 0

If changing the Character set is not enough you may need to use API's to change the keyboard layout at run time. Get back to me if you need this since I need to research this.


RE: switch input field to write a different language

Thank you ShankarJ for your response as usual.

Yes  Iam talking about the language of the keyboard.

I agree with you that it is mostly an API issue , I did some tests but it didnt work .

In my keyboard I press Left ALT+Shift to write in arabic , again I press the same buttons to write in English.

I hope this can give an indicator.

lots of thanks


RE: switch input field to write a different language


Did you try changing the Charset property?

Could you post the window layout of those two controls - the English & the Arabic one?


RE: switch input field to write a different language

Hello ,
yes I tried that but didnt work.
Here is a screen shot of the window layout.

thank you

RE: switch input field to write a different language


I want the window structure in text format i.e. press the ellipsis button, copy & paste that. Why? It looks like you have not set certain thinks like Layout to allow Right to Left entry for the Arabic control.


RE: switch input field to write a different language

this the window structure... thank you

QuickWindow WINDOW('Window'),AT(,,260,160),FONT('MS Sans Serif',8,,FONT:regular),CENTER,IMM,HLP('Main'), |
       BUTTON('&OK'),AT(207,142,49,14),USE(?Ok),FLAT,LEFT,MSG('Accept operation'),TIP('Accept Operation'), |


RE: switch input field to write a different language


This is what I have done so far. It works but it seems to create extra languages for the language bar.



            SJ_GetKeyboardLayoutName(LONG pwszKLID),BOOL,PROC,PASCAL,NAME('GetKeyboardLayoutNameA')
            SJ_LoadKeyboardLayout(LONG pwszKLID, ULONG xFlags),LONG,PROC,PASCAL,NAME('LoadKeyboardLayoutA')
            SJ_UnLoadKeyboardLayout(LONG xhkl),BOOL,PROC,PASCAL,NAME('UnloadKeyboardLayout')

EnglishString                STRING(60)
ArabicString                 STRING(60)

KeyBoardName                 CSTRING(255)
KB_Addr                      LONG(0)
Err                          LONG(0)

KLF_ACTIVATE                 EQUATE(1)

Arb_Eng                      BYTE(0)
ArabicKeyboard               EQUATE('00000401')
EnglishKeyboard              EQUATE('00000409')
Eng_HKL                      LONG
Arb_HKL                      LONG

Window WINDOW('Keyboard Language Test'),AT(,,164,90),FONT('Arial', 8,, FONT:bold),GRAY,WALLPAPER('BROWN.JPG'), Tiled
    PROMPT('In English'), AT(3,6), USE(?Prompt:EnglishString), TRN
    ENTRY(@S60), AT(36,6,121,10), USE(EnglishString), LEFT(1)
    PROMPT('In Arabic'), AT(3,21), USE(?Prompt:ArabicString), TRN
    ENTRY(@S60), AT(36,21,121,10), USE(ArabicString), LAYOUT(1), FONT('Andalus', 9,,, CHARSET:ARABIC)
    STRING(@S255), AT(2,39,161), USE(KeyBoardName), FONT(,, COLOR:Red), CENTER
    BUTTON('&Get Keyboard Layout'), AT(3,56,84,14), CURSOR('finger.cur'), USE(?GetLayout), LEFT
    BUTTON('&Toggle Keyboard Layout'), AT(3,73,84,14), CURSOR('finger.cur'), USE(?SetLayout), LEFT
    BUTTON('&Close'), AT(110,73,48,14), CURSOR('finger.cur'), USE(?Close), ICON('WACANCEL.ICO'), |




    OF EVENT:CloseWindow
    OF EVENT:Accepted
      CASE FIELD()
      OF ?GetLayout
        KB_Addr = ADDRESS(KeyBoardName)
        IF SJ_GetKeyboardLayoutName(KB_Addr) > 0
           Err = SJ_GetLastError() ; IF Err THEN MESSAGE('Error = ' & Err).

      OF ?SetLayout
        Arb_Eng = 1 - Arb_Eng
        IF Arb_Eng
           KeyBoardName = ArabicKeyboard
           KeyBoardName = EnglishKeyboard  ! UK
        KB_Addr = ADDRESS(KeyBoardName) ; KeyBoardName = CLIP(KeyBoardName) & '<0>'
        HKL# = SJ_LoadKeyBoardLayout(KB_Addr, KLF_ACTIVATE)
        IF HKL# > 0
           IF Arb_Eng THEN Arb_HKL = HKL# ELSE Eng_HKL = HKL#.
           Err = SJ_GetLastError() ; MESSAGE('Error = ' & Err)
        POST(EVENT:Accepted, ?GetLayout)
      OF ?Close
        IF Eng_HKL
           IF SJ_UnLoadKeyBoardLayout(Eng_HKL) > 0
              Err = SJ_GetLastError() ; MESSAGE('Error = ' & Err)

        IF Arb_HKL
           IF SJ_UnLoadKeyBoardLayout(Arb_HKL) > 0
              Err = SJ_GetLastError() ; MESSAGE('Error = ' & Err)





RE: switch input field to write a different language

well done shankar. it worked fine , just I changed one thing that I changed the control type to Text Field instead of Entry field because arabic charachters doesnt show properly in Entry field (letters will appear separate) and I changed the font to be more clear. nothing else I changed.
Here is the screen layout:


Window WINDOW('Keyboard Language Test'),AT(,,164,90),FONT('Arial',12,,FONT:bold),WALLPAPER('BROWN.JPG'), |
       PROMPT('In English'),AT(3,6),USE(?Prompt:EnglishString),TRN
       PROMPT('In Arabic'),AT(3,21),USE(?Prompt:ArabicString),TRN
       text,AT(36,21,121,10),USE(ArabicString),FONT('Arabic Transparent',12,,FONT:regular,CHARSET:ARABIC),LAYOUT(1)
       BUTTON('&Get Keyboard Layout'),AT(3,56,84,14),USE(?GetLayout),LEFT,CURSOR('finger.cur')
       BUTTON('&Toggle Keyboard Layout'),AT(3,73,84,14),USE(?SetLayout),LEFT,CURSOR('finger.cur')
and this is a screen shot of a successful test

Thank you for your help

RE: switch input field to write a different language


When you use a Text Box as an Entry control, you need to use the SINGLE attribute to prevent the user from pressing <Enter> which will insert the CRLF (<13,10>) characters.

Did you check your Language Bar in Windows after running this app? Were new Languages created in that? If so, you have to fine tune the equates, ArabicKeyboard EQUATE('00000401') & EnglishKeyboard  EQUATE('00000409') to the correct values for sub-language in the first 4 characters.

Good luck.


RE: switch input field to write a different language

yes. the Language Bar in Windows is changinging according to the button press.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close