I've been searching for such of this functions to make a local programs with PB in my language which is hebrew.
There are other Right to left languages such as arabic.
So i just had to post this in case another PB user search for this method.

Big thanks to thefool and va!n

*edit: thanks nco2k*
Code: Select all
;========================================
;Right-To-Left Window, Menus and gadgets!
;Enable you to localize your apps in PB!
;========================================
;By Pantcho 2006
;Big thanks for thefool !!
;MessageBox RTL constants by va!n
;A little event loop grabbed from PB examples ;)
;===============================
;RTL msg box constants
#MB_RIGHT = $80000
#MB_RTLREADING = $100000
Procedure RTLwindow(WinNum, Switch)
If Switch = 1
SetWindowLong_(WindowID(WinNum),#GWL_EXSTYLE,#WS_EX_LAYOUTRTL | 0)
ElseIf Switch = 0
SetWindowLong_(WindowID(WinNum),#GWL_EXSTYLE,0)
EndIf
; Window Refresh Is Required
SetWindowPos_(WindowID(WinNum), 0, -1 , -1, -1, -1, #SWP_NOSIZE | #SWP_NOMOVE | #SWP_NOZORDER | #SWP_FRAMECHANGED | #SWP_SHOWWINDOW)
EndProcedure
Procedure RTLgadget(GadgetNum, Switch)
If Switch = 1
SetWindowLong_(GadgetID(GadgetNum),#GWL_EXSTYLE,#WS_EX_LAYOUTRTL | 0)
ElseIf Switch = 0
SetWindowLong_(GadgetID(GadgetNum),#GWL_EXSTYLE,0)
EndIf
EndProcedure
If OpenWindow(0, 0, 0 ,200, 200, "RTL window Title", #PB_Window_ScreenCentered|#PB_Window_SystemMenu )
If CreateMenu(0, WindowID(0))
MenuTitle("File")
MenuItem( 1, "&Load...")
MenuItem( 2, "Save")
MenuItem( 3, "Save As...")
MenuBar()
OpenSubMenu("Recents")
MenuItem( 5, "C:\Autoexec.bat")
MenuItem( 6, "D:\Test.txt")
OpenSubMenu("Even more !")
MenuItem( 12, "Test")
CloseSubMenu()
MenuItem( 13, "C:\Ok.bat")
CloseSubMenu()
MenuBar()
MenuItem( 7, "&Quit")
MenuTitle("Edition")
MenuItem( 8, "Cut")
MenuItem( 9, "Copy")
MenuItem(10, "Paste")
MenuTitle("?")
MenuItem(11, "About")
EndIf
DisableMenuItem(0, 3, 1)
DisableMenuItem(0, 13, 1)
ButtonGadget(1,10,30,80,20,"RTL")
ButtonGadget(2,10,60,80,20,"LRT - normal")
ListViewGadget(3,100,30,90,120)
For x = 1 To 30
AddGadgetItem(3,-1,"Text "+ Str(X))
Next x
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
If EventGadget() = 1
RTLwindow(0,1)
RTLgadget(3,1)
ElseIf EventGadget() = 2
RTLwindow(0,0)
RTLgadget(3,0)
EndIf
Case #PB_Event_Menu
Select EventMenu()
Case 11
MessageRequester("About", "Cool RTL MessageBox!", #MB_RIGHT|#MB_RTLREADING )
Default
MessageRequester("Info", "MenuItem: "+Str(EventMenu()), #MB_RIGHT|#MB_RTLREADING )
EndSelect
Case #PB_Event_CloseWindow
Quit = 1
EndSelect
Until Quit = 1
EndIf
End