Sign in to follow this  
Followers 0
StuffByDennis

Is there a GuiCtrlGetPos

3 posts in this topic

When I create a list with the $WS_SIZEBOX style I am able to change the left,top,width and height of the list with the mouse.

I would like to save the new values so when I run the program they start up as last set.

Other than tracking the mouse position and calculating the required parameter values how do I do it.

a function GuiCtrlGetPos is needed. How come this was left out of the available functions, seems like a no-brainer.

Thanks in advance for any help you can give me.

StuffByDennis

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi! Try this:

#include <GuiConstants.au3>

Global $config = @ScriptDir & "\param.ini"
Global $aPos = IniReadSection($config, "Position")

$hGUI = GUICreate("Test GUI", 200, 100)

$hListBox = GUICtrlCreateList("Test ListBox", $aPos[1][1], $aPos[2][1], $aPos[3][1], $aPos[4][1], BitOR($WS_SIZEBOX, $LBS_SORT, $WS_BORDER, $WS_VSCROLL))

GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd

Dim $aNewPos = ControlGetPos("Test GUI", "", GUICtrlGetHandle($hListBox))

For $i = 0 To UBound($aNewPos) - 1
    $aPos[$i + 1][1] = $aNewPos[$i]
Next

IniWriteSection($config, "Position", $aPos)
:)

Param.ini:

[Position]
Left=11
Top=13
Width=123
Height=64
Edited by rasim

Share this post


Link to post
Share on other sites

When I create a list with the $WS_SIZEBOX style I am able to change the left,top,width and height of the list with the mouse.

I would like to save the new values so when I run the program they start up as last set.

Other than tracking the mouse position and calculating the required parameter values how do I do it.

a function GuiCtrlGetPos is needed. How come this was left out of the available functions, seems like a no-brainer.

Thanks in advance for any help you can give me.

StuffByDennis

Thanks,

I must be getting old.

I looked for an hour and could find it.

StuffByDennis

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
Sign in to follow this  
Followers 0