Friday, August 17, 2018

CtrlBox on Left Side

Since some are using Arabic/Urdu which deals with the right-to-left reading and data entry, then this trick might be useful to them. Which is to transpose too the position of the ControlBox of Titlebar.

This trick is really quite simple requiring only 3 lines of codes involving GetWindowLong and SetWindowLong.  I just added some codes to show how it looks like.  See if this can come handy to you:


loTest = Createobject("Form1")
loTest.Show(1)
Read Events


Define Class form1 As Form
      AutoCenter = .T.
      Caption = 'ControlBox on Left side'
      ShowWindow = 2

      Add Object label1 As Label With ;
            top = 20,;
            left = 10,;
            FontSize = 16,;
            width = Thisform.Width -20,;
            height = Thisform.Height - 20,;
            WordWrap = .T.,;
            Caption = "This shows how to reverse the title bar's OBJECT positions such as "+;
            "controlbox, icon and labels while leaving the inside of the form on normal left to right positions"

      Procedure Load
            Declare Integer SetWindowLong In user32 Integer HWnd, Integer nIndex, Integer dwNewLong
            Declare Integer GetWindowLong In user32 Integer HWnd, Integer nIndex
            SetWindowLong(Thisform.HWnd, -20, Bitor(GetWindowLong(Thisform.HWnd, -16), 0x80000))
      Endproc

      Procedure Destroy
            Clear Events
      Endproc
Enddefine





Cheers!

No comments:

Post a Comment