[Gambas-user] How to Change Keyboard Layout

Wael M wael79xy at yahoo.com
Wed Oct 3 23:27:09 CEST 2018


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

--------------------------------------------
On Wed, 10/3/18, Gianluigi <bagonergi at gmail.com> wrote:

 Subject: Re: [Gambas-user] How to Change Keyboard Layout
 To: "Gambas Mailing List" <user at lists.gambas-basic.org>
 Date: Wednesday, October 3, 2018, 4:00 PM
 
 With this code, I'm trying to explain better
 what I meant to say:
 
 Public
 Sub TextBox1_GotFocus()
   
   Dim s As String
   
  
 Desktop.SendKeys("{[Shift_L]6}")
   Wait 0.1
   s =
 TextBox1.Text
   Print s
  
 Wait 0.1
   TextBox1.Clear
   If s = "&" Then
     Print "Italian keyboard"
   Else
     Print
 "Stranger keyboard"
   Endif
   
 End
 
 Regards
 Gianluigi
 
 Il giorno
 mer 3 ott 2018 alle ore 09:45 Gianluigi <bagonergi at gmail.com>
 ha scritto:
 >Lee, I subscribed to the list
 you mentioned but should I repeate the same thread there or
 what?
 
 
 
 >Charlie, thanks for your answer but it didn't
 exactly did what I want
 
 >I'm using Ubuntu 
 
 >the code you put gave me this result:
 XKBLAYOUT=us,ara
 
 >what I need to get is the current keyboard layout
 
 >maybe I wasn't clear while putting my problem, so
 I"ll try to explain more
 
 >I want to check my current keyboard layout so if its
 Arabic, it would be changed to English (in >some
 textboxes) and vices versa.
 
 >i.e I want to use English in some textboxes and Arabic
 in others, and I 
 want that to be done >through a code to check Keyboard
 layout and change 
 it if needed or keep it if no need to change >it
 
 >thanks in advance to everyone trying to help 
 
 This
 code that need to do something else, maybe you can direct it
 to a key that makes you understand if the keyboard is
 'ara' or 'us'.
 RegardsGianluigi
 
 
 ----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----
 
 -----Inline Attachment Follows-----
 
 


More information about the User mailing list