Jump to content

Weird Problem


Achilles
 Share

Recommended Posts

Alright, this is an actual replication of a problem I'm having, I can't get it to show the message box! Here's the code:

#noTrayIcon 
#include <GuiConstants.au3>

Opt("TrayOnEventMode", 1)
Opt("GUIOnEventMode", 1) 
Opt("TrayMenuMode", 1)

Local $firstGUI, $secondGUI

Local $successess = 0

Local $count



TrayCreateItem('Test') 
    TrayItemSetOnEvent(-1, '_Test') 

TrayCreateItem('') 

TrayCreateItem('Exit')
    TrayItemSetOnEvent(-1, '_Exit')

TraySetState()

While 1 
    Sleep(250) 
    ConsoleWrite(' |MAIN LOOP| ')
    $count += 1
    If Mod($count, 8) = 0 then ConsoleWrite(@CRLF)
WEnd

Func _Test() 
    $firstGUI = GuiCreate('A', 125, 145, -1, -1, $DS_SETFOREGROUND) 
        GuiSetOnEvent($GUI_EVENT_CLOSE, '_Close') 

    GuiCtrlCreateButton('Test', 10, 10, 100, 100) 
        GuiCtrlSetOnEvent(-1, '_NewTest') 
        
    GuiSetState()
EndFunc 

Func _NewTest() 
    $secondGUI = GuiCreate('B', 125, 145, -1, -1, $DS_SETFOREGROUND) 
        GuiSetOnEvent($GUI_EVENT_CLOSE, '_CloseTwo') 
    
    GuiCtrlCreateButton('Test Two', 10, 10, 100, 100) 
        GuiCtrlSetOnEvent(-1, '_NewestTest')
        
    $successess = 0
    
    GuiSetState()
    
    While $successess = 0 
        Sleep(250) 
        ConsoleWrite(' |OTHER LOOP| ')
        $count += 1
        If Mod($count, 8) = 0 then ConsoleWrite(@CRLF)
    WEnd
    
    Msgbox(0, 'Yay', 'We are finsihed!');  <----- GOAL IS TO GET HERE
    Exit
EndFunc

Func _NewestTest() 
    Msgbox(0, '', 'Success')
    GuiDelete($secondGUI)
    $successess += 1 ;  <----- THIS SHOULD ALLOW US TO GET TO OUR GOAL
EndFunc

Func _Close() 
    GuiDelete($firstGUI) 
EndFunc

Func _CloseTwo() 
    GuiDelete($secondGUI) 
EndFUnc

Func _Exit() 
    Exit 
EndFunc

How to win the Smiley:

If you can modify this code so that I can see the message box my pressing the button on the GUI "B" you win the smiley!

Requirements and rules:

- There must be a tray icon, two GUI's

- The tray must trigger the first GUI which must trigger the second GUI

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

#noTrayIcon 
#include <GuiConstants.au3>

Opt("TrayOnEventMode", 1)
Opt("GUIOnEventMode", 1) 
Opt("TrayMenuMode", 1)

Local $firstGUI, $secondGUI

Local $successess = 0

Local $count



TrayCreateItem('Test') 
    TrayItemSetOnEvent(-1, '_Test') 

TrayCreateItem('') 

TrayCreateItem('Exit')
    TrayItemSetOnEvent(-1, '_Exit')

TraySetState()

While 1 
    Sleep(250) 
    ConsoleWrite(' |MAIN LOOP| ')
    $count += 1
    If Mod($count, 8) = 0 then ConsoleWrite(@CRLF)
WEnd

Func _Test() 
    $firstGUI = GuiCreate('A', 125, 145, -1, -1, $DS_SETFOREGROUND) 
        GuiSetOnEvent($GUI_EVENT_CLOSE, '_Close') 

    GuiCtrlCreateButton('Test', 10, 10, 100, 100) 
        GuiCtrlSetOnEvent(-1, '_NewTest') 
        
    GuiSetState()
EndFunc 

Func _NewTest() 
    $secondGUI = GuiCreate('B', 125, 145, -1, -1, $DS_SETFOREGROUND) 
        GuiSetOnEvent($GUI_EVENT_CLOSE, '_CloseTwo') 
    
    GuiCtrlCreateButton('Test Two', 10, 10, 100, 100) 
        GuiCtrlSetOnEvent(-1, '_NewestTest')
        
    $successess    = 0
    
    GuiSetState()
EndFunc

    While $successess = 0 
        Sleep(250) 
        ConsoleWrite(' |OTHER LOOP| ')
        $count += 1
        If Mod($count, 8) = 0 then ConsoleWrite(@CRLF)
    WEnd
    
    Msgbox(0, 'Yay', 'We are finsihed!');  <----- GOAL IS TO GET HERE
    Exit
;EndFunc

Func _NewestTest() 
    Msgbox(0, '', 'Success')
    GuiDelete($secondGUI)
    $successess += 1 ;  <----- THIS SHOULD ALLOW US TO GET TO OUR GOAL
EndFunc

Func _Close() 
    GuiDelete($firstGUI) 
EndFunc

Func _CloseTwo() 
    GuiDelete($secondGUI) 
EndFUnc

Func _Exit() 
    Exit 
EndFunc

Do I get a smily now? :)

- Pas

Link to comment
Share on other sites

I modified your code a bit, let me know if this will work for you.

#noTrayIcon
#include <GuiConstants.au3>

Opt("TrayOnEventMode", 1)
Opt("GUIOnEventMode", 1)
Opt("TrayMenuMode", 1)

Local $firstGUI, $secondGUI

Local $successess = 0

Local $count



TrayCreateItem('Test')
    TrayItemSetOnEvent(-1, '_Test')

TrayCreateItem('')

TrayCreateItem('Exit')
    TrayItemSetOnEvent(-1, '_Exit')

TraySetState()

While 1
    Sleep(250)
    ConsoleWrite(' |MAIN LOOP| ')
    $count += 1
    If Mod($count, 8) = 0 then ConsoleWrite(@CRLF)
WEnd

Func _Test()
    $firstGUI = GuiCreate('A', 125, 145, -1, -1, $DS_SETFOREGROUND)
        GuiSetOnEvent($GUI_EVENT_CLOSE, '_Close')

    GuiCtrlCreateButton('Test', 10, 10, 100, 100)
        GuiCtrlSetOnEvent(-1, '_NewTest')
        
    GuiSetState()
EndFunc

Func _NewTest()
    $secondGUI = GuiCreate('B', 125, 145, -1, -1, $DS_SETFOREGROUND)
        GuiSetOnEvent($GUI_EVENT_CLOSE, '_CloseTwo')
    
    GuiCtrlCreateButton('Test Two', 10, 10, 100, 100)
        GuiCtrlSetOnEvent(-1, '_NewestTest')
        
    $successess = 0
    
    GuiSetState()
    
EndFunc

Func _NewestTest()
    Msgbox(0, '', 'Success')
    GuiDelete($secondGUI)
    $successess += 1 ;  <----- THIS SHOULD ALLOW US TO GET TO OUR GOAL
    If $successess <> 0 Then _Finished()
EndFunc

Func _Finished()
    While $successess = 0
        Sleep(250)
        ConsoleWrite(' |OTHER LOOP| ')
        $count += 1
        If Mod($count, 8) = 0 then ConsoleWrite(@CRLF)
    WEnd
    
    Msgbox(0, 'Yay', 'We are finsihed!');  <----- GOAL IS TO GET HERE
    Exit
EndFunc

Func _Close()
    GuiDelete($firstGUI)
EndFunc

Func _CloseTwo()
    GuiDelete($secondGUI)
EndFUnc

Func _Exit()
    Exit
EndFunc

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

Link to comment
Share on other sites

I modified your code a bit, let me know if this will work for you.

;code
Alright I give up on this problem. What you did could help me solve the problem but I found a much easier solution. What my original code had was a button that brought up a GUI that gave you an option to choose between two different things but on that GUI I wasn't getting any response. So, I've decided to just make two different buttons, it will look better two because all my buttons are custom made and the GUI that I made wasn't so this way I'll have more of my program in my style GUI.

Anyways, thanks for the help...

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Alright I give up on this problem. What you did could help me solve the problem but I found a much easier solution. What my original code had was a button that brought up a GUI that gave you an option to choose between two different things but on that GUI I wasn't getting any response. So, I've decided to just make two different buttons, it will look better two because all my buttons are custom made and the GUI that I made wasn't so this way I'll have more of my program in my style GUI.

Anyways, thanks for the help...

So do I get the smiley or not? :)

Agreement is not necessary - thinking for one's self is!

My-Colors.jpg

cuniform2.gif

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...