TommyDDR

GUICtrlSetResizing and hidden window

3 posts in this topic

#1 ·  Posted (edited)

Hi,

I have to set a resizing mode to differents controls in a hidden gui, that gui is initialised (hidden) and resized by a WinMove.

But when i show it, control are not resized where thez should.

There is a simple code that reproduce the problem.

Same gui, same content, one displayed then moved, the other moved then displayed :

#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)
Opt("MustDeclareVars", 1)

Global $gui[2]
Global $labels[2]
Global $taille[2] = [200, 100]

For $i = 0 To UBound($gui, 1) - 1
    $gui[$i] = GUICreate($i, $taille[0], $taille[1], $i * ($taille[0]+100) + 500, (@DesktopHeight-$taille[1])/2)
    GUISetOnEvent($GUI_EVENT_CLOSE, "quit", $gui)
    $labels[$i] = GUICtrlCreateLabel("Test resizing...", $taille[0]-105, $taille[1]-25, 100, 20)
    GUICtrlSetBkColor($labels[$i], 0xE0E0E0)
    GUICtrlSetResizing($labels[$i], BitOR($GUI_DOCKRIGHT, $GUI_DOCKBOTTOM, $GUI_DOCKWIDTH, $GUI_DOCKHEIGHT))
Next
GUISetState(@SW_SHOW, $gui[0])

For $i = 0 To UBound($gui, 1) - 1
    WinMove($gui[$i], "", Default, Default, $taille[0]+100, $taille[1]+100)
Next
GUISetState(@SW_SHOW, $gui[1])

While(True)
    Sleep(10)
WEnd

Func quit()
    Exit
EndFunc

Is that a bug or do miss i something ?

EDIT : This bug disapear if gui is shown at lease one time (even if hide then)

Edited by TommyDDR

_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).

Share this post


Link to post
Share on other sites



TommyDDR,

This is not a bug, but AutoIt's behaviour changed between the 3,3,12.# and 3.3.14.# releases. I ran into a similar problem and when I asked I was told that It had to with getting the $WS_EX_RTL extended style to work correctly. Now you need to use GUISetState before using WinMove as until then the function will only affect the GUI and not its controls - as your code shows.

The simple solution to your problem is to set the GUI as hidden before using WinMove:

GUISetState(@SW_SHOW, $gui[0])
GUISetState(@SW_HIDE, $gui[1]) ; Added line <<<<<<<<<<<<<<<

Now the controls are correctly positioned in both GUIs after the move.

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

Thank's for the tips, it works now ;)


_GUIRegisterMsg (Register more than 1 time the same Msg), _Resize_Window (GUICtrlSetResizing for children windows), _GUICtrlSetOnHover (Link a function when mouse go on, left, clic down, clic up, on a control), _InputHeure (Create an input for hour contain), _GUICtrlCalendar (Make a complete calendar), _GUICtrlCreateGraphic3D (Create a 3D graph), _ArrayEx.au3 (Array management), _GUIXViewEx.au3 (List/Tree View management).

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

  • Similar Content

    • VAN0
      By VAN0
      Hello.
      I have a program XX that asks for user confirmation on exit, which hangs the system reboot/shutdown process until I confirm. So I decided create a autoit script that would automatically close that dialog and let the system reboot/shutdown.
      The problem I'm facing is that my scripts now exits before the XX.
      Is there a way delay script exit until the XX is closed but only when system is rebooting/shutting down?
       
      Thank you.
    • Simpel
      By Simpel
      Hi, I created a gui with date field but formatted as time in HH:mm. It always shows "now-time". Even if I try to set it with GUICtrlSetData.
      #include <DateTimeConstants.au3> #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Example() Func Example() GUICreate("My GUI get date", 200, 200, 800, 200) Local $idDate = GUICtrlCreateDate("", 20, 20, 100, 20, $DTS_TIMEFORMAT) ; to select a specific default format Local $sStyle = "HH:mm" ; Just display hours and minutes <<<<<<<<<<<<<<<<<<<<<<<<<<<< GUICtrlSendMsg($idDate, $DTM_SETFORMATW, 0, $sStyle) ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUICtrlSetData($idDate, "00:00") ConsoleWrite(GUICtrlRead($idDate) & @CRLF) GUISetState(@SW_SHOW) ; Loop until the user exits. While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd MsgBox($MB_SYSTEMMODAL, "Time", GUICtrlRead($idDate)) EndFunc ;==>Example How can I set the time field with another time and how can this field be set blank?
      Regards, Conrad
    • hunte922
      By hunte922
      Edit: The solution! Maybe?
       
      I need to download an image from a website using AutoIt but the download, when viewed in a text editor, does not appear to be the same as if I had downloaded it from a web browser.
      Could anyone help me figure out why this is happening?
      I've already tried _INetGetSource, InetGet, _IENavigate, wget, this, and a few .bat and .vbs scripts.
       
      Example Code:
      #include <Inet.au3> Local $source = _INetGetSource("http://c0.rbxcdn.com/0db36a45eae4838667ae9a46ba0c082a") Local $newfile = FileOpen(@ScriptDir & "\test.txt", 2) FileWrite($newfile, $source) FileClose($newfile) Image URL: http://c0.rbxcdn.com/0db36a45eae4838667ae9a46ba0c082a
      Screenshot attached.

    • echoAwoo
      By echoAwoo
      SOLVED
      Basically, my script needed a conditional assignment to a variable. It needed to check if the size of the array was valid before assigning any value to the variable.
       
       


      So I've got a data entry task that I've been trying to automate. I actually have the script running, it cycles, draws it's necessary arrays, etc. But it will only cycle up to count #22, 23+ do not work.
      THE GIST
      I have two excel documents that I draw the data from. $aWO array has values from one of these documents. The instructions to draw these are under _at_wo().
      This function feeds into another function to compare a derived value from the first file and request it's corresponding value. In order to do this, I used _Excel_RangeFind() (had to comment out the Cell Name and Cell Comment aspects of that function in order for it to work at all.) Then I pull the address information from array $aTracking[0][2], swap the column from A to B, and it works beautifully. 
      Then cycle 23 happens, and then $aTracking[0][2] reports as out of range. Why? 
       
      Here's the code. Error reported from line #70. This array call works on loops 1-22 ($iCount value 0-21)
      http://pastebin.com/Bd5v6Dbc
    • Simpel
      By Simpel
      Hi,
      I updated to the last version. Since then a lot of functions are not working.  For instance expanding abbreviation. My au3abbrev.properties are correct and abbrev.properties are including both import lines. The abbreviation is red but won't expand. Neither with space nor Ctrl+B.
      Debug to msgbox and console not working, list functions, jump to function, open include too.
      SciTE Jump works. Block and box comment too.
      I have the feeling all functions especially for autoit are not working.
      Any help? Regards, Conrad