Jump to content
Anas

$WS_EX_LAYOUTRTL and GUICtrlSetPos

Recommended Posts

Anas

Hi,

If I set $WS_EX_LAYOUTRTL as an extended style for a GUI, GUICtrlSetPos no longer works correctly when used in a WM_Size function, what is problem?

Thanks.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Global $GUI, $LV
Example()

Func Example()
    Opt("GUIOnEventMode", 1)
    Opt("GUIResizeMode", $GUI_DOCKALL)

    $GUI = GUICreate("My GUI position", 250, 150, Default, Default, $WS_OVERLAPPEDWINDOW, $WS_EX_LAYOUTRTL)
    $LV = GUICtrlCreateListView("col0", 20, 20, 180, 80)

    GUISetOnEvent($GUI_EVENT_CLOSE, 'Close')
    GUIRegisterMsg($WM_SIZE, "WM_SIZE")
    GUISetState()

    While 1
        Sleep(1000)
    WEnd
EndFunc

Func WM_SIZE($hWnd, $iMsg, $wParam, $lParam)
    #forceref $hWnd, $iMsg, $wParam, $lParam

    Local $Size = WinGetClientSize($GUI)
    If $Size[0] > 250 Then GUICtrlSetPos($LV, 20, 20, 180 + ($Size[0] - 250))
    If $Size[1] > 150 Then GUICtrlSetPos($LV, 20, 20 + ($Size[1] - 150)) ;using 'Default' instead of '20' for the left side of the control makes it disapper
    Return $GUI_RUNDEFMSG
EndFunc

Func Close()
    Exit
EndFunc

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×