Jump to content

Funny GUICreate Behavior with hidden GUI's


YellowLab
 Share

Recommended Posts

I have a script where I make a bunch of GUI windows - like 30-40. They get named with an asterik and then a number based on their location in a matrix, i.e. *0, *1, *2. Everything works fine when all the GUI windows are visible. Crazy things happen when the GUIs are not visible and then shown later.

The following script shows the behavior.

The first part of the script creates 21 GUI's sequentially numbered and shows them immediately after creation.

The second part of the script (after you press escape), the GUI's are sequentially created, but not shown until after all are created and then shown.

For $i=0 to 21
    GUICreate('*'&$i,150,15,20,0+$i*20)
    GUISetState(@SW_SHOW,WinGetHandle('*'&$i))
Next

Do
    $nMsg=GUIGetMsg()
Until $nMsg=-3

For $i=0 to 21
    GUIDelete(WinGetHandle('*'&$i))
Next

For $i=0 to 21
    GUICreate('*'&$i,150,15,20,0+$i*20)
Next
For $i=0 to 21
    GUISetState(@SW_SHOW,WinGetHandle('*'&$i))
Next
$arTemp=WinGetPos('*1')
ConsoleWrite("Y Position of Window *1 - "&$arTemp[1]&@CRLF)
$arTemp=WinGetPos('*19')
ConsoleWrite("Y Position of Window *19 - "&$arTemp[1]&@CRLF)
Do
    $nMsg=GUIGetMsg()
Until $nMsg=-3

Two of them are missing #1 and #19. The console reports Window *1 to be at 360 or position 18. The console reports Window *19 to be at 380, where it should be 19*20=380. In addition, in the first part of the script - #21 - the last GUI created is the focus. However, in the second part of the script, #20 (the last minus one created) is the focus.

My guess is that I am missing something incredibly simple, but I am pulling my hair out trying to figure this one out. Any help would be appreciated.

Thanks.

You can't see a rainbow without first experiencing the rain.

Link to comment
Share on other sites

I have a script where I make a bunch of GUI windows - like 30-40. They get named with an asterik and then a number based on their location in a matrix, i.e. *0, *1, *2. Everything works fine when all the GUI windows are visible. Crazy things happen when the GUIs are not visible and then shown later.

The following script shows the behavior.

The first part of the script creates 21 GUI's sequentially numbered and shows them immediately after creation.

The second part of the script (after you press escape), the GUI's are sequentially created, but not shown until after all are created and then shown.

For $i=0 to 21
    GUICreate('*'&$i,150,15,20,0+$i*20)
    GUISetState(@SW_SHOW,WinGetHandle('*'&$i))
Next

Do
    $nMsg=GUIGetMsg()
Until $nMsg=-3

For $i=0 to 21
    GUIDelete(WinGetHandle('*'&$i))
Next

For $i=0 to 21
    GUICreate('*'&$i,150,15,20,0+$i*20)
Next
For $i=0 to 21
    GUISetState(@SW_SHOW,WinGetHandle('*'&$i))
Next
$arTemp=WinGetPos('*1')
ConsoleWrite("Y Position of Window *1 - "&$arTemp[1]&@CRLF)
$arTemp=WinGetPos('*19')
ConsoleWrite("Y Position of Window *19 - "&$arTemp[1]&@CRLF)
Do
    $nMsg=GUIGetMsg()
Until $nMsg=-3

Two of them are missing #1 and #19. The console reports Window *1 to be at 360 or position 18. The console reports Window *19 to be at 380, where it should be 19*20=380. In addition, in the first part of the script - #21 - the last GUI created is the focus. However, in the second part of the script, #20 (the last minus one created) is the focus.

My guess is that I am missing something incredibly simple, but I am pulling my hair out trying to figure this one out. Any help would be appreciated.

Thanks.

Try adding this line to the start of your script

Opt("WinTitleMatchModew",3)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...