Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Button Not Working - Child Windows, GUIOnEventMode

GUIOnEventMode

  • Please log in to reply
6 replies to this topic

#1 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,871 posts

Posted 19 February 2013 - 07:02 PM

I have the following code: I cannot get the last button in the third GUI to do anything. Can a NEW pair of eys check it out and see what I did wrong?

AutoIt         
#include <GUIConstantsEx.au3> Global $_GuiAir, $_Button666, $bPassed = False, $_GuiName Example() Func Example() Opt("GUIOnEventMode", 1) GUICreate("Parent1") GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_MINIMIZE, "SpecialEvents") GUISetOnEvent($GUI_EVENT_RESTORE, "SpecialEvents") GUICtrlCreateButton("New Gui", 10, 60, 50) GUICtrlSetOnEvent(-1, "_Air") GUISetState(@SW_SHOW) ; Just idle around While 1 Sleep(10) WEnd EndFunc ;==>Example Func _Air() $_GuiAir = GUICreate('Air Call') GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") $_Button666 = GUICtrlCreateButton('TestIT', 0, 0) GUICtrlSetOnEvent($_Button666, "__AirCall") GUISetState(@SW_SHOW, $_GuiAir) EndFunc ;==>_Air Func __AirCall() Switch @GUI_CtrlId Case $_Button666 ;MsgBox('', '', 'pop') Name('name') If $bPassed Then GUISetState(@SW_HIDE, $_GuiName) GUIDelete($_GuiName) GUISetState(@SW_HIDE, $_GuiAir) GUIDelete($_GuiAir) $bPassed = False EndIf EndSwitch EndFunc ;==>__AirCall Func Name($sName) Local $font = "Comic Sans MS" $sAnswer = $sName $_GuiName = GUICreate('Air Check' & $sName, 400, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") ;GUICtrlCreateLabel($sName, 50, 5, 200, 50) ;GUICtrlSetFont(-1, 20, 400, 1, $font) ;$_InputCheck = GUICtrlCreateInput('', 50, 100, 200, 50) ;GUICtrlSetFont(-1, 20, 400, 1, $font) $_ButtonCheck = GUICtrlCreateButton('CHECK', 20, 150, 50, 30) GUISetOnEvent($_ButtonCheck, 'test') GUISetState(@SW_HIDE, $_GuiAir) GUIDelete($_GuiAir) GUISetState(@SW_SHOW, $_GuiName) EndFunc ;==>Name Func test() MsgBox('', '', 'button pressed') EndFunc ;==>test Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE MsgBox(0, "Close Pressed", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle) Exit Case @GUI_CtrlId = $GUI_EVENT_MINIMIZE MsgBox(0, "Window Minimized", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle) Case @GUI_CtrlId = $GUI_EVENT_RESTORE MsgBox(0, "Window Restored", "ID=" & @GUI_CtrlId & " WinHandle=" & @GUI_WinHandle) EndSelect EndFunc ;==>SpecialEvents

Edited by nitekram, 19 February 2013 - 08:46 PM.

"Sometimes you have to go back to where you started, to get to where you want to go."  "Everybody catches up with everyone, eventually"  "As you teach others, you are really teaching yourself." all by me. From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow."

Windows_error.gif

How to ask a Question Forum SearchWIKI FAQ Tutorials Original FAQ - AutoIt Snippets - Multple Guis - Interrupting a running functionAnother Send StringRegExp StringRegExp Help RegEX TesterONLINE HELP UDF's Wiki AutoIt PDF AutoItSetOption Macros Wiki Arrays AutoIt Snippets WrapperAutoit Docs SCITE SciteJump - BB MyTopicsProgramming UDFs AutoIt_101 UDFs Form - UDFTutorial - Tutorials - Documentation - IE.AU3Games? - FreeSoftwarePath_Online

 

Spoiler







#2 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,448 posts

Posted 19 February 2013 - 07:16 PM

Which one is the third GUI and which button, just so I don't have to start counting GUI functions.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#3 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,871 posts

Posted 19 February 2013 - 07:19 PM

$_GuiName is the third gui - in the function Name()

"Sometimes you have to go back to where you started, to get to where you want to go."  "Everybody catches up with everyone, eventually"  "As you teach others, you are really teaching yourself." all by me. From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow."

Windows_error.gif

How to ask a Question Forum SearchWIKI FAQ Tutorials Original FAQ - AutoIt Snippets - Multple Guis - Interrupting a running functionAnother Send StringRegExp StringRegExp Help RegEX TesterONLINE HELP UDF's Wiki AutoIt PDF AutoItSetOption Macros Wiki Arrays AutoIt Snippets WrapperAutoit Docs SCITE SciteJump - BB MyTopicsProgramming UDFs AutoIt_101 UDFs Form - UDFTutorial - Tutorials - Documentation - IE.AU3Games? - FreeSoftwarePath_Online

 

Spoiler

#4 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,448 posts

Posted 19 February 2013 - 07:22 PM

Change the second line:
$_ButtonCheck = GUICtrlCreateButton('CHECK', 20, 150, 50, 30) GUICtrlSetOnEvent($_ButtonCheck, 'test') ; <<<<<<<<<<<<<<<<< Change it to this



If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#5 nitekram

nitekram

    Ng1-Nf3

  • Active Members
  • PipPipPipPipPipPip
  • 1,871 posts

Posted 19 February 2013 - 07:27 PM

I feel stupid - thanks

"Sometimes you have to go back to where you started, to get to where you want to go."  "Everybody catches up with everyone, eventually"  "As you teach others, you are really teaching yourself." all by me. From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow."

Windows_error.gif

How to ask a Question Forum SearchWIKI FAQ Tutorials Original FAQ - AutoIt Snippets - Multple Guis - Interrupting a running functionAnother Send StringRegExp StringRegExp Help RegEX TesterONLINE HELP UDF's Wiki AutoIt PDF AutoItSetOption Macros Wiki Arrays AutoIt Snippets WrapperAutoit Docs SCITE SciteJump - BB MyTopicsProgramming UDFs AutoIt_101 UDFs Form - UDFTutorial - Tutorials - Documentation - IE.AU3Games? - FreeSoftwarePath_Online

 

Spoiler

#6 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,448 posts

Posted 19 February 2013 - 09:06 PM

No need to feel stupid, sometimes Scite's "intellisense" gives you options and we don't pay close enough attention. Happens to me all of the time.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to an XP machine, and I'm not going to.

 

Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude

 

How to ask questions the smart way!

 

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.
Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.
_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.


#7 acidman

acidman

    Universalist

  • Banned (NOT IN USE)
  • 266 posts

Posted 20 February 2013 - 12:29 PM

$_ButtonCheck = GUICtrlCreateButton('CHECK', 20, 150, 50, 30) GUICtrlSetOnEvent(-1, "Buttontest") ; or you can do it like this, this way you wont get confused with a bunch of variable names

Edited by Cid, 20 February 2013 - 12:33 PM.

My dream is to have a dream...





Also tagged with one or more of these keywords: GUIOnEventMode

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users