corgano

Resizeable Gui ($WS_SIZEBOX) not responding properly to WinMove()

4 posts in this topic

#1 ·  Posted (edited)

If I create a window that has $WS_SIZEBOX style, I set up docking on the controls, and I click and drag it the controls stay inside the window correctly.

If I take the SAME window, and I use WinMove() to change it's size, none of the control sizes / positions update. How can I update my window after the WinMove() so autoit sees it changed size and repositions the controls?

SOLUTION: Put the winMove() AFTER you winSetState() to make the window visible!

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites



#2 ·  Posted

@corgano almost 1000 posts you should know to provide your code, or a reproducer, rather than expect someone to guess at exactly what you're doing in your GUI and then troubleshoot for you. Help us help you.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I thought it'd be simple enough an example wasn't needed, here is the example from the help file, with the winmove added:

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

Example()

Func Example()
    Opt("GUICoordMode", 2)
    $gui = GUICreate("My InputBox", 190, 114, -1, -1, $WS_SIZEBOX + $WS_SYSMENU) ; start the definition

    GUISetFont(8, -1, "Arial")

    GUICtrlCreateLabel("Prompt", 8, 7) ; add prompt info
    GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKTOP)

    Local $idEdit = GUICtrlCreateInput("Default", -1, 3, 175, 20, $ES_PASSWORD) ; add the input area
    GUICtrlSetState($idEdit, $GUI_FOCUS)
    GUICtrlSetResizing($idEdit, $GUI_DOCKBOTTOM + $GUI_DOCKHEIGHT)

    Local $idOK = GUICtrlCreateButton("OK", -1, 3, 75, 24) ; add the button that will close the GUI
    GUICtrlSetResizing($idOK, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKHCENTER)

    Local $idCancel = GUICtrlCreateButton("Annuler", 25, -1) ; add the button that will close the GUI
    GUICtrlSetResizing($idCancel, $GUI_DOCKBOTTOM + $GUI_DOCKSIZE + $GUI_DOCKHCENTER)

    WinMove($gui, "", 100, 100, 400, 200)
    GUISetState(@SW_SHOW) ; to display the GUI

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd
EndFunc   ;==>Example

However by accIdent, i found the solution:
Put winMove() AFTER the guiSetState()!!!!

Making that change magically makes it work! While you didn't provide a solution, I found the solution while making an example to show the problem so i could get help finding a solution, so...thanks?

Edited by corgano

0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e

Share this post


Link to post
Share on other sites

#4 ·  Posted

corgano,

This caught me  out a few years ago - apparently a fix to the code to get the $WS_EX_RTL style to work correctly meant that from 3.3.13.19 onwards, you need to use GUISetState before any WinMove commands or the autoresizing will not work. I was told at the time that the Help file would be modified to reflect this but I cannot find anything so I will look to add something myself.

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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