<div dir="ltr"><div dir="ltr"><div>Hi Fabien,</div><div>I confess to having bluffed, I do not know how to set up and calls with SendKeys: Super_L+Space, by default on Ubuntu Bionic to switch layout. ;-D<br>Maybe we should ask the user of the program to set himself the keyboard shortcut for example on CTRL+ALT+K and some other (simple) similar alternative, what do you think?<br><br>Regards<br>Gianluigi<br></div></div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno ven 5 ott 2018 alle ore 06:41 Fabien Bodard <<a href="mailto:gambas.fr@gmail.com">gambas.fr@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto">In fact as the switching dépend of the desktop it os not easily portable to other desktop... it s a quite hard coded thing. You will need to add a config option to your program to allow final user to adapt it to its current desktop shortcut.</div><br><div class="gmail_quote"><div dir="ltr">Le jeu. 4 oct. 2018 23:00, Gianluigi <<a href="mailto:bagonergi@gmail.com" target="_blank">bagonergi@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr">With activated gb.desktop component:<br><br>Private $bArabian As Boolean<br><br>Public Sub Form_Open()<br> <br> Dim s As String<br> Dim hTxt As TextBox<br> <br> hTxt = New TextBox(Me)<br> hTxt.Foreground = Color.Transparent<br> hTxt.SetFocus <br> Me.Show<br> Wait 0.1<br> ' This combination works with the Italian layout and not with the American one.<br> ' You must find a combination suitable for Arabic.<br> Desktop.SendKeys("{[Shift_L]6}")<br> Wait 0.1<br> s = hTxt.Text<br> hTxt.Delete<br> If s = "&" Then<br> $bArabian = True<br> Print "Arabian keyboard" <br> Else<br> $bArabian = False<br> Print "American keyboard"<br> Endif<br> Print $bArabian<br> <br>End<br><br>Public Sub txtArabian_GotFocus()<br> ' I don't remember your shortcut to switch keyboard layout, supposing Ctrl+K<br> If $bArabian = False Then<br> Desktop.SendKeys("{[Control_L]K}")<br> $bArabian = True<br> Endif<br> <br>End<br><br>Public Sub txtAmerican_GotFocus()<br> ' I don't remember your shortcut to switch keyboard layout, supposing Ctrl+K<br> If $bArabian Then<br> Desktop.SendKeys("{[Control_L]K}")<br> $bArabian = False<br> Endif<br> <br>End<br><br>Public Sub Form_KeyPress() <br> <br> If Key.Code = Key["K"] And If Key.Control Then<br> Print "SWITCH KEYBOARD"<br> End If<br> <br>End<br></div><div dir="ltr"><br></div><div>Regards</div><div>Gianluigi<br></div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno gio 4 ott 2018 alle ore 21:41 Wael M via User <<a href="mailto:user@lists.gambas-basic.org" rel="noreferrer" target="_blank">user@lists.gambas-basic.org</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Gianluigi and thanks Lee<br>
you both put some solutions that seems brilliant but I got confused and couldn't get an appropriate code out of those<br>
is my fault I know but don't forget I'm new to Gambas <br>
so if you please could send me an example for a forum with two textboxes each one changes the keyboard language when it get focus, I will be profoundly appreciated<br>
<br>
thanks again for your valuable time<br>
<br>
--------------------------------------------<br>
On Thu, 10/4/18, T Lee Davidson <<a href="mailto:t.lee.davidson@gmail.com" rel="noreferrer" target="_blank">t.lee.davidson@gmail.com</a>> wrote:<br>
<br>
Subject: Re: [Gambas-user] How to Change Keyboard Layout<br>
To: <a href="mailto:user@lists.gambas-basic.org" rel="noreferrer" target="_blank">user@lists.gambas-basic.org</a><br>
Date: Thursday, October 4, 2018, 3:08 PM<br>
<br>
If each box will use a specific<br>
layout, you could use a semaphore.<br>
<br>
[code]<br>
Public $IsEnglishLayout<br>
= True<br>
<br>
Public Sub<br>
EnglishTextbox1_GotFocus()<br>
If Not<br>
$IsEnglishLayout then Destkop.Sendkeys(blah)<br>
$IsEnglishLayout = True<br>
End<br>
<br>
Public Sub<br>
ArabicTextbox1_GotFocus()<br>
If<br>
$IsEnglishLayout then Destkop.Sendkeys(blah)<br>
$IsEnglishLayout = False<br>
End<br>
[/code]<br>
<br>
<br>
___<br>
Lee<br>
<br>
<br>
On 10/3/18 5:27 PM, Wael M<br>
via User wrote:<br>
> Thank you very much<br>
Gianluigi for your help, grazie :)<br>
> it<br>
worked and could detect my language but not the way I<br>
want<br>
> let me tell you my story :)<br>
> I came to linux from windows and I'm<br>
trying to translate an app I did with VB to the<br>
corresponding codes in Gambas.<br>
> I<br>
realized that Gambas is not the same as VB because Linux is<br>
not the same as windows<br>
> Gambas is just<br>
using the same names and following the main rules of VB <br>
> in my app I had a form that with three<br>
textboxes are filled in Arabic and three are filled in<br>
English<br>
> when I put the cursor in a<br>
textbox it detects the keyboard layout and change it to the<br>
desired language<br>
> I followed the code<br>
you gave but I want to put the event of this code to be when<br>
textbox got focus<br>
> here is the problem,<br>
when I put cursor in the desired textbox, it evokes the code<br>
and losing the focus the focus again the textbox making it<br>
evoking the same code again and so on<br>
><br>
so what I really need is to detect the keyboard layout like<br>
reading it directly from linux<br>
> <br>
> again and again thank you very much for<br>
your patience and help<br>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
<br>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div>
<br>
----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net" rel="noreferrer" target="_blank">https://www.hostsharing.net</a> ]----<br>
</blockquote></div>