[Gambas-user] How to Change Keyboard Layout

T Lee Davidson t.lee.davidson at gmail.com
Thu Oct 4 14:08:48 CEST 2018

If each box will use a specific layout, you could use a semaphore.

Public $IsEnglishLayout = True

Public Sub EnglishTextbox1_GotFocus()
  If Not $IsEnglishLayout then Destkop.Sendkeys(blah)
  $IsEnglishLayout = True

Public Sub ArabicTextbox1_GotFocus()
  If $IsEnglishLayout then Destkop.Sendkeys(blah)
  $IsEnglishLayout = False


On 10/3/18 5:27 PM, Wael M via User wrote:
> Thank you very much Gianluigi for your help, grazie :)
> it worked and could detect my language but not the way I want
> let me tell you my story :)
> I came to linux from windows and I'm trying to translate an app I did with VB to the corresponding codes in Gambas.
> I realized that Gambas is not the same as VB because Linux is not the same as windows
> Gambas is just using the same names and following the main rules of VB 
> in my app I had a form that with three textboxes are filled in Arabic and three are filled in English
> when I put the cursor in a textbox it detects the keyboard layout and change it to the desired language
> I followed the code you gave but I want to put the event of this code to be when textbox got focus
> here is the problem, when I put cursor in the desired textbox, it evokes the code and losing the focus the focus again the textbox making it evoking the same code again and so on
> so what I really need is to detect the keyboard layout like reading it directly from linux
> again and again thank you very much for your patience and help

More information about the User mailing list