All Non-English windows users, please help!
Posted: Tue Jun 13, 2006 12:20 pm
Hello
Recently i asked how can i localize PB apps.
There are some languages in the world the the writing position is not from Left-to-right like english and many other, there are some Right-to-left languages like my own, Hebrew and other like Arabic.
I found the solution which basicly makes a window OR a gadget localized.
What does it mean? it means:
- if a window is being modfied to be RTL language that all gadgets on the windows are being mirrored (not so important..)
- if a gadget is being modified to be RTL language then if it is a ListIconGadget the columns are being viewed in the oppsite way,
Its means that if you add the gadget "1" + chr(10) + "2" + chr(10)+"3"
you wont see 1 | 2 | 3
you will see 3 | 2 | 1
So far so good. You can see i posted in tricks and tips here
http://www.purebasic.fr/english/viewtopic.php?t=21840
But i have now a diffrent problem
It seems that the RTLGadget procedure i have in tricks and tips
Is might not be correct cause it works well on ListIconGadget , ListViewGadget but doesnt create a reguler border like a normal gadget creation, so i had to force a draw of a border like this:
Now it is "OK" since there is a border but all other gadget like
StringGadget,EditorGadget are making a weird behavior!
thats why i said in the title Non-English, because the procedure automakes the gadget in the local language and when i write in my language (using Alt+shift to change cursor language) i get a weird space with the cursor and with Editorgadget i get nothing!
2nd Solution.
If you non-english users try to open any text box notepad.exe for example, and press the Right CTRL+ Right Shift
You will see that the gadget/notepad is auto being Right-To-Left (scrollbar changes it position to the leftside of the app/gadget)
the aligning is being changed.
So i tried this method to use SendKeys functions i found in the forums.
It seems it does work BUT ONLY to the last gadget?!?
Here is an Example which you can test the RTLGadget Procedure
And the SendKeys
Sorry PB 3.94 Code , i am doing a huge project with PB 3.94
So i delayed the move on PB4 later.
in this code the sendkeys procedure i made takes effect only on the last gadget being changed all other return to default ?!?! 
I am sorry for my bad english i cant explain myself good
but if you know windows API and see i might didnt put the correct values OR if you found a way to make this code works.
PLEASE HELP.
I apperciate your replies very much.
thank you.
Recently i asked how can i localize PB apps.
There are some languages in the world the the writing position is not from Left-to-right like english and many other, there are some Right-to-left languages like my own, Hebrew and other like Arabic.
I found the solution which basicly makes a window OR a gadget localized.
What does it mean? it means:
- if a window is being modfied to be RTL language that all gadgets on the windows are being mirrored (not so important..)
- if a gadget is being modified to be RTL language then if it is a ListIconGadget the columns are being viewed in the oppsite way,
Its means that if you add the gadget "1" + chr(10) + "2" + chr(10)+"3"
you wont see 1 | 2 | 3
you will see 3 | 2 | 1
So far so good. You can see i posted in tricks and tips here
http://www.purebasic.fr/english/viewtopic.php?t=21840
But i have now a diffrent problem
It seems that the RTLGadget procedure i have in tricks and tips
Is might not be correct cause it works well on ListIconGadget , ListViewGadget but doesnt create a reguler border like a normal gadget creation, so i had to force a draw of a border like this:
Code: Select all
Procedure RTLgadget(GadgetNum.l,Switch.l,Border.l)
If Switch = 1
If Border = 1
SetWindowLong_(GadgetID(GadgetNum),#GWL_EXSTYLE,#WS_EX_LAYOUTRTL | 0 | #WS_EX_CLIENTEDGE)
Else
SetWindowLong_(GadgetID(GadgetNum),#GWL_EXSTYLE,#WS_EX_LAYOUTRTL | 0 )
EndIf
SetWindowLong_(SendMessage_(GadgetID(GadgetNum),#LVM_GETHEADER,0, 0) ,#GWL_EXSTYLE,#WS_EX_LAYOUTRTL | 0)
ElseIf Switch = 0
SetWindowLong_(GadgetID(GadgetNum),#GWL_EXSTYLE,#WS_EX_CLIENTEDGE)
SetWindowLong_(GadgetID(GadgetNum),#GWL_EXSTYLE,0)
EndIf
EndProcedure
StringGadget,EditorGadget are making a weird behavior!
thats why i said in the title Non-English, because the procedure automakes the gadget in the local language and when i write in my language (using Alt+shift to change cursor language) i get a weird space with the cursor and with Editorgadget i get nothing!
2nd Solution.
If you non-english users try to open any text box notepad.exe for example, and press the Right CTRL+ Right Shift
You will see that the gadget/notepad is auto being Right-To-Left (scrollbar changes it position to the leftside of the app/gadget)
the aligning is being changed.
So i tried this method to use SendKeys functions i found in the forums.
It seems it does work BUT ONLY to the last gadget?!?
Here is an Example which you can test the RTLGadget Procedure
And the SendKeys
Sorry PB 3.94 Code , i am doing a huge project with PB 3.94
So i delayed the move on PB4 later.
Code: Select all
Enumeration
#Window_Main
#Gadget_Editor
#Gadget_Editor1
#Gadget_Editor2
EndEnumeration
#WS_EX_LAYOUTRTL = 4194304
#LVM_GETHEADER = #LVM_FIRST + 31
Procedure SendKey(GadgetToShift.l)
ActivateGadget(GadgetToShift) ; put focus on gadget
; Set Right Ctrl+Right Shift
keybd_event_(#VK_RCONTROL,0,0 , 0);
keybd_event_(#VK_RSHIFT,0,0 , 0);
keybd_event_(#VK_RSHIFT,0, #KEYEVENTF_KEYUP,0);
keybd_event_(#VK_RCONTROL,0,#KEYEVENTF_KEYUP,0);
Delay(10)
;Set Alt+Shift
keybd_event_(#VK_MENU,0,0 , 0);
keybd_event_(#VK_SHIFT,0,0 , 0);
keybd_event_(#VK_SHIFT,0, #KEYEVENTF_KEYUP,0);
keybd_event_(#VK_MENU,0,#KEYEVENTF_KEYUP,0);
EndProcedure
If OpenWindow(#Window_Main, 0, 0, 800, 800, #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget | #PB_Window_SizeGadget | #PB_Window_TitleBar | #PB_Window_ScreenCentered, "RTL test")
If CreateGadgetList(WindowID(#Window_Main))
;EditorGadget(#Gadget_Editor, 10, 10, 620, 460)
StringGadget(#Gadget_Editor, 10, 10, 620, 200,"",#PB_String_MultiLine|#WS_VSCROLL)
StringGadget(#Gadget_Editor1, 10, 210, 620, 200,"",#PB_String_MultiLine|#WS_VSCROLL)
StringGadget(#Gadget_Editor2, 10, 420, 620, 200,"",#PB_String_MultiLine|#WS_VSCROLL)
EndIf
;RTLgadget(#Gadget_Editor,1,0) ; enable this with EditorGadget enabled to see how bad it looks
; sending the keys to make it local
SendKey(#Gadget_Editor)
SendKey(#Gadget_Editor1)
SendKey(#Gadget_Editor2)
Quit = #False
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = #True
EndSelect
Until Quit
EndIf
End

I am sorry for my bad english i cant explain myself good
but if you know windows API and see i might didnt put the correct values OR if you found a way to make this code works.
PLEASE HELP.
I apperciate your replies very much.
thank you.