Right-To-Left language support?!

Just starting out? Need help? Post your questions and find answers here.
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Right-To-Left language support?!

Post by Pantcho!! »

Hello All.
I think i am missing somthing here.
I have this application i want to code in Hebrew which is a right to left language, and it finally hit me - the menus are in the wrong position
the problem is with menus, listicongadget and all those gadgets .
Now i dont know what to do, i cant make the application in english.

Is there anyway i can make the whole app in a LOCAL mode?!

Please if you know anything in the subject write a comment, anything helpful will do.

Thank you.

Pantcho.
Num3
PureBasic Expert
PureBasic Expert
Posts: 2812
Joined: Fri Apr 25, 2003 4:51 pm
Location: Portugal, Lisbon
Contact:

Post by Num3 »

Have your tried to compiles with the unicode option ?
Dunno if it fixes it, but it's a possible solution!
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

The language fonts are okey, you can put any font you wish to any gadget of course but it is the position of the menus.
For example if a windows menu is diaplayed in the top left corner of the window in localized applications the menu start in the right top window corner.
2nd example is ListIconGadget which in localized languages the first field you enter like "field1" + chr(10) + "field2" the field2 if presented first because of the localization of the app.

there must be a way, even a suggestion will be nice.

Thank you.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

You guys also use left scrollbars right?
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

Yes, all software made in my hebrew language are in oppsite directions.
I personally never program in my mother language, but when you do know to programming but you cant localize it, that is very distrubing
there for i searched and downloaded a few examples and screen shot them.

ListIconGadget Example:
Image

ListViewGadget Example:
Image

And most important MenuBar example:
Image

ANY help/thoughts/advices will be great.

Thank you.
Pantcho.
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

@pantcho:
is this waht you are looking for? (same for windows?)

Code: Select all

; -------- by va!n --------

#MB_RIGHT      = $80000
#MB_RTLREADING = $100000

MessageBox_(0,"Test","Text from right to left",#MB_RIGHT|#MB_RTLREADING  )
MessageBox_(0,"Test","Text from right to left",#MB_RIGHT )
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

YES! awesome for a simple messagebox! but what about all other gadgets???? :P
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

@pantcho:
afaik its not so easy to do with PB commands, because stuff like scrollbar on left are API constants you have to use and i dont know if there is an easy way using SendMessage_ or something like this to change the flags of a window/control. when having next days some more time, i will try what i can do for you to solve the problem.
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

no support at all ;)
Only for Listview via Tabstops
For Other gadgets , i would prefer using Spaces in front of strings

Code: Select all

;;
; Right align with gadgets
; first atempt for ListView with tabstops
;
; done by  Siegfried.Rings 2 use in Purebasic (c) 2006
;
;

Procedure GadgetAlignRight(Gadget)

hwndListview= GadgetID(Gadget);get hwnd for gadget
result=SendMessage_(hwndListview,#LB_SETTABSTOPS,0,0) ;first set 2 NULL


;now calculate the distance from left 2 right
rc.RECT
GetClientRect_(hwndListview, @rc)
hDC = GetDC_(hwndListview)
If hDC 
  hFont = SendMessage_(hwndListview, #WM_GETFONT, 0, 0)
  hFontOld = SelectObject_(hDC, hFont)
  sChars.s = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
  sz.size
  If GetTextExtentPoint32_(hDC, sChars, Len(sChars), sz) 
   cxAvLBChar = sz\cx / Len(sChars)
   cxDlgBase = GetDialogBaseUnits_() 
   cxDlgBase =cxDlgBase & $FFFF
   CalcPixelsPerDlgUnit.f = (2 * cxAvLBChar) / cxDlgBase
  EndIf
  SelectObject_(hDC, hFontOld)
  ReleaseDC_(hwndListview, hDC)
EndIf
If CalcPixelsPerDlgUnit=0 
 ProcedureReturn
EndIf
value= - ((rc\Right - rc\Left)/CalcPixelsPerDlgUnit)
result=SendMessage_(hwndListview,#LB_SETTABSTOPS,1,@value);set tabstop
InvalidateRect_(hwndListview,0,-1);invalidate winbdow 2 redraw
EndProcedure



  If OpenWindow(0, 0, 0, 270, 240, "ListViewGadget", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(0))
    #Listview=0
   
    ListViewGadget(#Listview, 10, 10, 250, 120,#LBS_USETABSTOPS);note the additional flag !
    For a = 1 To 500
      AddGadgetItem (#Listview, -1, Chr(9) + "Item " + Str(a) + " of the Listview")   ; 
    Next
    SetGadgetState(0, 9)    
    GadgetAlignRight(#Listview)
    
    #Button=1
    ButtonGadget(#Button, 10, 130, 180, 30, "right Button",#PB_Button_Right) 
   
    #Text=2
    TextGadget(#Text, 10, 170, 180, 30, "right text",#PB_Text_Right) 
    
    #Checkbox=3
    CheckBoxGadget(#Checkbox,10, 200, 180, 30, "right Checkbox",#PB_CheckBox_Right)
    
    Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  EndIf

SPAMINATOR NR.1
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Rings wrote:no support at all ;)
Absolutely untrue..

Code: Select all

SetWindowLong_(GadgetID(Listview_0),#GWL_EXSTYLE,#WS_EX_LAYOUTRTL|0)
this will set your listview scollbar to the left, and all text to the right. (Like its supposed to be when its RTL)

for the window:

Code: Select all

SetWindowLong_(WindowID(window_0),#GWL_EXSTYLE,#WS_EX_LAYOUTRTL | 0);#WS_EX_TOOLWINDOW)
  SetWindowPos_(WindowID(window_0), 0, -1 , -1, -1, -1, #SWP_NOSIZE | #SWP_NOMOVE | #SWP_NOZORDER  | #SWP_FRAMECHANGED | #SWP_SHOWWINDOW) 
Pantcho!!
Enthusiast
Enthusiast
Posts: 538
Joined: Tue Feb 24, 2004 3:43 am
Location: Israel
Contact:

Post by Pantcho!! »

Thanks Rings for you detailed example! i apperciate it alot!

And va!n to you too

and damn big thanks to thefool!! for showing it is possible.

I posted a little code in the tricks and tips

http://www.purebasic.fr/english/viewtopic.php?t=21840

Pantcho.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Very useful information, thanks!


BTW, is that constant "WS_EX_LAYOUTRTL" anywhere in your SDK and if so, how did you find it?
@}--`--,-- A rose by any other name ..
thefool
Always Here
Always Here
Posts: 5875
Joined: Sat Aug 30, 2003 5:58 pm
Location: Denmark

Post by thefool »

Dare2; check ApiViewer!
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

thefool wrote:Dare2; check ApiViewer!
Okay, found it. Checked it out. Just had a quick look and looks magic! Thanks! :)
@}--`--,-- A rose by any other name ..
User avatar
Rings
Moderator
Moderator
Posts: 1435
Joined: Sat Apr 26, 2003 1:11 am

Post by Rings »

thefool wrote:
Rings wrote:no support at all ;)
Absolutely untrue..
that should only mean that i do not support my code :)
SPAMINATOR NR.1
Post Reply