Jump to content
Sign in to follow this  
eHrgo

OnEvent - Two GUI, second one ... inactive

Recommended Posts

eHrgo

Hi guys, this time I want to make an easy example:

#include <GUIConstants.au3>

Opt("GuiOnEventMode",1)

$Main=GUICreate ( 'Main Window', 90, 135, -1, -1, $WS_MINIMIZEBOX ) 
$close=GUICtrlCreateButton ( 'Close', 3, 90, 113, 18 )
$history=GUICtrlCreateButton ( 'History', 3, 73, 113, 18)
    
GUICtrlSetOnEvent($Close, 'quit')   
GUICtrlSetOnEvent($history, 'History')

While 1         
    GuiSetState(@SW_SHOW)
Wend

;~ ;;FUNCTIONS-----------------------------------------------------------
Func quit()
    Exit 0
EndFunc

Func History()
    $Histo=GUICreate ( 'Secondary Window', 300, 150, -1, -1,$WS_MINIMIZEBOX, $WS_EX_TOPMOST  )
    $CloseHis=GUICtrlCreateButton ( 'Cancel', 5, 105, 285, 18 )
    
GUICtrlSetOnEvent($CloseHis, 'quit')
    While 1
        GUISetState ( @SW_SHOW, $Histo)
        Sleep(50)
    Wend

And an Easy question: Why the "GUICtrlSetOnEvent($CloseHis, 'quit')" in the Second UI isn't working?

Thanks a lot

Edited by eHrgo

Sorry for my Bad English.

Share this post


Link to post
Share on other sites
evilertoaster

Can't break 'inturupts' within 'inturupts' with gui events...

http://www.autoitscript.com/forum/index.php?showtopic=28292

http://www.autoitscript.com/forum/index.php?showtopic=42375

One of the more annoying factors of the feature IMO...

you'll want-

#include <GUIConstants.au3>

Opt("GuiOnEventMode",1)

$Main=GUICreate ( 'Main Window', 90, 135, -1, -1, $WS_MINIMIZEBOX ) 
$close=GUICtrlCreateButton ( 'Close', 3, 90, 113, 18 )
$history=GUICtrlCreateButton ( 'History', 3, 73, 113, 18)
    
GUICtrlSetOnEvent($Close, 'quit')   
GUICtrlSetOnEvent($history, 'History')
GuiSetState(@SW_SHOW)
While 1         
    Sleep(1000)
Wend

;~ ;;FUNCTIONS-----------------------------------------------------------
Func quit()
    Exit 0
EndFunc

Func History()
    $Histo=GUICreate ( 'Secondary Window', 300, 150, -1, -1,$WS_MINIMIZEBOX, $WS_EX_TOPMOST  )
    $CloseHis=GUICtrlCreateButton ( 'Cancel', 5, 105, 285, 18 )
    GUICtrlSetOnEvent($CloseHis, 'quit')
    GUISetState ( @SW_SHOW, $Histo)
EndFunc

Share this post


Link to post
Share on other sites
Zedna

Try this:

#include <GUIConstants.au3>

Opt("GuiOnEventMode",1)

$Main=GUICreate ( 'Main Window', 90, 135, -1, -1, $WS_MINIMIZEBOX ) 
$close=GUICtrlCreateButton ( 'Close', 3, 90, 113, 18 )
$history=GUICtrlCreateButton ( 'History', 3, 73, 113, 18)
    
GUICtrlSetOnEvent($Close, 'quit')   
GUICtrlSetOnEvent($history, 'History')
GuiSetState(@SW_SHOW)

While 1         
    Sleep(1000)
Wend

;~ ;;FUNCTIONS-----------------------------------------------------------
Func quit()
    Exit 0
EndFunc

Func History()
    Global $Histo=GUICreate ( 'Secondary Window', 300, 150, -1, -1,$WS_MINIMIZEBOX, $WS_EX_TOPMOST  )
    $CloseHis=GUICtrlCreateButton ( 'Cancel', 5, 105, 285, 18 )
    GUICtrlSetOnEvent($CloseHis, 'quit2')
    GUISetState ( @SW_SHOW, $Histo)
EndFunc

Func quit2()
    GUIDelete($Histo)
EndFunc

Share this post


Link to post
Share on other sites
eHrgo

Yep, thanks a lot, its almost the same Exemple... i'm stupid, I musn't do any loop.

Working great, thanks a lot.


Sorry for my Bad English.

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.