A standard toggle-box widget has its label on the right. This example applies the BS_LEFTTEXT style to bring the label to the left.
As you can see in the picture, the checkboxes are not vertically aligned anymore. Tex Texin wrote a
procedure to fix this: see http:www.xencraft.com/resources/rightside-checkbox.html
RUN ToggleLeftText (toggle-1:HWND). RUN ToggleLeftText (toggle-2:HWND).
PROCEDURE ToggleLeftText : /* ------------------------------------------------------------- purpose: place the label on the left side. do not run this procedure more than once for each toggle-box ------------------------------------------------------------- */ DEFINE INPUT PARAMETER HWND AS INTEGER. DEFINE VARIABLE styles AS INTEGER NO-UNDO. DEFINE VARIABLE returnvalue AS INTEGER NO-UNDO. RUN GetWindowLongA(HWND, {&GWL_STYLE}, OUTPUT styles). styles = styles + {&BS_LEFTTEXT}. RUN SetWindowLongA(HWND, {&GWL_STYLE}, styles, OUTPUT styles). /* force a repaint */ RUN InvalidateRect(HWND,0,1,OUTPUT returnvalue). END PROCEDURE.
Definitions used in this example:
&GLOBAL-DEFINE GWL_STYLE -16 &GLOBAL-DEFINE BS_LEFTTEXT 32 PROCEDURE GetWindowLongA EXTERNAL "user32.dll" : DEFINE INPUT PARAMETER phwnd AS LONG. DEFINE INPUT PARAMETER cindex AS LONG. DEFINE RETURN PARAMETER currentlong AS LONG. END PROCEDURE. PROCEDURE SetWindowLongA EXTERNAL "user32.dll" : DEFINE INPUT PARAMETER phwnd AS LONG. DEFINE INPUT PARAMETER cindex AS LONG. DEFINE INPUT PARAMETER newlong AS LONG. DEFINE RETURN PARAMETER oldlong AS LONG. END PROCEDURE. PROCEDURE InvalidateRect EXTERNAL "user32.dll" : DEFINE INPUT PARAMETER HWND AS LONG. DEFINE INPUT PARAMETER lpRect AS LONG. DEFINE INPUT PARAMETER bErase AS LONG. DEFINE RETURN PARAMETER ReturnValue AS LONG. END PROCEDURE.