×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

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

(OP)
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

Hi!

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 ::

CODE

  ?<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 ::

CODE

  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.

Regards
 

RE: switch input field to write a different language

(OP)
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

Hi!

Did you try changing the Charset property?

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

Regards
 

RE: switch input field to write a different language

(OP)
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

Hi!

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.

Regards
 

RE: switch input field to write a different language

(OP)
hello,
this the window structure... thank you

QuickWindow WINDOW('Window'),AT(,,260,160),FONT('MS Sans Serif',8,,FONT:regular),CENTER,IMM,HLP('Main'), |
         SYSTEM,GRAY,RESIZE
       TEXT,AT(67,29,129,10),USE(eng),#ORIG(eng)
       TEXT,AT(69,76,129,10),USE(arb),SINGLE,LAYOUT(1),#ORIG(arb)
       BUTTON('&OK'),AT(207,142,49,14),USE(?Ok),FLAT,LEFT,MSG('Accept operation'),TIP('Accept Operation'), |
           ICON('WAOK.ICO'),#SEQ(1),#ORIG(?Ok)
     END

 

RE: switch input field to write a different language

Hi!

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

CODE

        program

        map
          MODULE('WINAPI')
            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')
            SJ_GetLastError(),UNSIGNED,PASCAL,NAME('GetLastError')
          END
        end

EnglishString                STRING(60)
ArabicString                 STRING(60)

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

KLF_ACTIVATE                 EQUATE(1)
KLF_REPLACELANG              EQUATE(16)

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'), |
        LEFT
 END

  CODE

  OPEN(Window)

  DISPLAY()

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

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

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

        BREAK
      END
    END
  END

  CLOSE(Window)

  RETURN

Regards
 

RE: switch input field to write a different language

(OP)
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:

CODE

Window WINDOW('Keyboard Language Test'),AT(,,164,90),FONT('Arial',12,,FONT:bold),WALLPAPER('BROWN.JPG'), |
         TILED,GRAY
       PROMPT('In English'),AT(3,6),USE(?Prompt:EnglishString),TRN
       text,AT(36,6,121,10),USE(EnglishString),LEFT(1)
       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)
       STRING(@S255),AT(2,39,161,),USE(KeyBoardName),CENTER,FONT(,,COLOR:Black,)
       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')
       BUTTON('&Close'),AT(110,73,48,14),USE(?Close),LEFT,CURSOR('finger.cur'),ICON('WACANCEL.ICO')
     END
and this is a screen shot of a successful test



Thank you for your help
 

RE: switch input field to write a different language

Hi!

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.

Regards
 

RE: switch input field to write a different language

(OP)
Hello,
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