Jump to content

Bug (maybe) in guiSetState( @SW_RESTORE, $gui ) ....


 Share

Recommended Posts

I'm pretty sure all autoit  gurus here will have an answer for me :-)

so here the code :

#include <guiconstants.au3>
#include <constants.au3>



func wndMinimize()
   guiSetState( @SW_MINIMIZE, $gui )
endfunc

func wndMaximize()
   guiSetState( @SW_MAXIMIZE, $gui )
endfunc

func wndRestore()
   guiSetState( @SW_RESTORE, $gui )
endfunc

func wndClose()
  exit
endfunc


opt( "GUIOnEventMode", 1)


$flag = bitOr( $WS_SYSMENU, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)
;$flag = 0
$gui = guiCreate( "Hello World", 200, 200, 200, 200, $flag )


guiSetOnEvent( $GUI_EVENT_MINIMIZE, "wndMinimize" )
guiSetOnEvent( $GUI_EVENT_MAXIMIZE, "wndMaximize" )

guiSetOnEvent( $GUI_EVENT_RESTORE, "wndRestore" )

guiSetOnEvent( $GUI_EVENT_CLOSE, "wndClose" )

guiSetState( @SW_SHOW )
while 1
   sleep( 1000 )
wend

I basicly just redefine Minize, Maximize, Restore and Close ...  because in my application I will need to do some stuff in there ....

but here the problem,   script start and display a hello world,  if I minimize it, and click on the icon on the task bar( actually restoring it )  the restore works fine, window is at the right place...

but if I maximine the window and minimize it , the restore bring back a window NOT maximized !

if you comment out  this line

guiSetOnEvent( $GUI_EVENT_RESTORE, "wndRestore" )

and let windoze do the restore a maximized window minimized in the task bar will be restore as a maximized window,  so do you think ? ...

maybe there is a "bug" in the  "guiSetState( @SW_RESTORE, $gui )" ...

:-)

Edited by JoeCool
Link to comment
Share on other sites

  • Moderators

JowCool,

Just add

Opt("GUIEventOptions", 1)
to your code - it then works as you expect. :)

If you want to code for the window events, best you stop Windows doing its own thing at the same time. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
Share on other sites

  • Moderators

JoeCool,

I have also closed the Trac ticket you opened - perhaps a little prematurely. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...