Sign in to follow this  
Followers 0
IchBistTod

Odd Error O.o

7 posts in this topic

This error really isnt logically making any sense

Okay I click the Support button(bottom-left) and an additional GUI pops up with independent variables(I'VE TRIED USING BOTH GLOBAL AND LOCAL VARIABLES).

When I close the second gui without clicking on anything it deletes the second GUI properly, however when I interact with the second gui by clicking the emergency support button, then attempt to close the secondary GUI, BOTH guis are deleted.

Here is my code, any insight would be very helpful.

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

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("MedWare, Inc. Support Center", 341, 388, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
GUISetBkColor(0xFFFFFF)
$Button3 = GUICtrlCreateButton("Button1", 180, 16, 135, 160, $BS_BITMAP)
GUICtrlSetImage(-1, "img04.bmp", 0)
$Button4 = GUICtrlCreateButton("Button1", 16, 16, 135, 160, $BS_BITMAP)
GUICtrlSetImage(-1, "img03.bmp", 0)
$Button5 = GUICtrlCreateButton("Button1", 16, 202, 135, 160, $BS_BITMAP)
GUICtrlSetImage(-1, "img02.bmp", 0)
$Button8 = GUICtrlCreateButton("Button1", 180, 202, 135, 160, $BS_BITMAP)
GUICtrlSetImage(-1, "img05.bmp", 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $button5
            _support()
        EndSwitch
WEnd


func _support()
    Global $Form1_1 = GUICreate("Support", 182, 146, -1, -1, -1, BitOR($WS_EX_TOOLWINDOW,$WS_EX_WINDOWEDGE))
Local $Button1_1 = GUICtrlCreateButton("Email Support", 8, 8, 163, 17, 0)
Local $Button2_2 = GUICtrlCreateButton("Telephone Support", 8, 35, 163, 17, 0)
Local $Button3_3 = GUICtrlCreateButton("FAQ Center", 8, 60, 163, 17, 0)
Local $Button4_4 = GUICtrlCreateButton("EMERGENCY SUPPORT", 1, 96, 179, 49, 0)
GUICtrlSetFont(-1, 9.5, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
GUICtrlSetTip(-1, "For emergencies only")
GUICtrlSetCursor (-1, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
GUIDelete($Form1_1)
ExitLoop
Case $button4_4
Local $msg = MsgBox(20, "Warning", "This feature will contact ALL support reprentitives by text message for support at ANY hour day or night for immediate support, and the first one able to respond will do so. There is a $20 fee assesed to your account for the use of this feature, please use this feature only in situations where a technological emergency is present. Are you sure you wish to continue?")
ConsoleWrite($msg&@CRLF)
EndSwitch
WEnd
Return
EndFunc

[center][/center][center]=][u][/u][/center][center][/center]

Share this post


Link to post
Share on other sites



IchBistTod,

The main GUI is not deleted when I run your code - it is however hidden behind any other open windows. :)

Adding a WinActivate($Form1) line after deleting the child GUI brings it back to the top of the z-order and so into view. :)

M23


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

You probably have an issue that messages stay in the message queue due to the blocking MSGBOX() function.

You can ensure the queue is empty before closing and deleting the window by doing:

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                While $nMsg
                    $nMsg = GUIGetMsg()
                WEnd
                GUIDelete($Form1_1)
                ExitLoop
            Case $Button4_4
                Local $msg = MsgBox(20, "Warning", "This feature will contact ALL support reprentitives by text message for support at ANY hour day or night for immediate support, and the first one able to respond will do so. There is a $20 fee assesed to your account for the use of this feature, please use this feature only in situations where a technological emergency is present. Are you sure you wish to continue?")
                ConsoleWrite($msg & @CRLF)
        EndSwitch
    WEnd

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

IchBistTod,

The main GUI is not deleted when I run your code - it is however hidden behind any other open windows. :)

Adding a WinActivate($Form1) line after deleting the child GUI brings it back to the top of the z-order and so into view. :)

M23

I thought that too until I moved the MSGBOX() out of the way and click a couple of times on the X of the second window. Then close the MSGBOX() and see what happens.

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Jos,

That is not an odd error - that is logical. :P

The MsgBox blocks the script - the 2 GUI_EVENT_CLOSE events produced by the clicks on the child [X] are queued. The MsgBox is closed so the queue is opened. The first _CLOSE event closes the child - the second _CLOSE event closes the main GUI because that is all there is left. :)

As I explain in the Managing Multiple GUIs tutorial in the Wiki, I would recommend using the "advanced" parameter with GUIGetMsg if there are multiple GUIs so you can determine which GUI sent which message. :)

M23


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

This is not the case the GUI dissapears regardless of if there are commands in the buffer or not, thanks for the advice though.

I have isolated the CAUSE, if the msgbox is a child to the child window, the specified behavior occurs, however if is a child to the parent, the specified behavior does not.

I believe this may be a bug in autoit source as this should not logically happen.

Either way a WinActivate() is required to keep the GUIs in order (as assigning the parent, asthe parent of the msgbox puts the child gui behind the parent gui and requires that it be brought back to the front)

Thanks for your help, but if this is not a bug in the autoit source code, then what logical cause could be behind this happening?


[center][/center][center]=][u][/u][/center][center][/center]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Also I have removed the buffer problem, and also accidental exit of the application by adding some checks and balances to make sure the GUIs only accept commands to their respective windows (using the advanced guigetmsg paramter as melba suggested) to stop the parent gui from accepting messages while the child window is open, and to stop the guis from accepting messages from one another.

Edited by IchBistTod

[center][/center][center]=][u][/u][/center][center][/center]

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