figgler Posted July 19, 2007 Share Posted July 19, 2007 Hi Heres my code i have looked at the help file and the forum but there seems to be little on child gui's expandcollapse popup#include <GUIConstants.au3> Global $AboutOK, $AboutGUI $WinTop = @DesktopHeight / 2 ; Y coord $WinLeft = @DesktopWidth / 2 ; X coord ; Main GUI $MainGUI = GUICreate("Tools", 200, 420, $WinLeft, $WinTop) $MenuFile = GUICtrlCreateMenu("File") $MenuAddtoList = GUICtrlCreateMenuItem("Add Item", $MenuFile) $MenuRemove = GUICtrlCreateMenuItem("Remove Item", $MenuFile) $MenuExit = GUICtrlCreateMenuItem("Exit", $MenuFile) $MenuExtras = GUICtrlCreateMenu("Extras") $MenuAddStart = GUICtrlCreateMenuItem("Add Startup", $MenuExtras) $MenuDelStart = GUICtrlCreateMenuItem("Del Startup", $MenuExtras) $MenuPos = GUICtrlCreateMenuItem("Save Possition", $MenuExtras) $MenuWin = GUICtrlCreateMenu("Computer") $WinReboot = GUICtrlCreateMenuItem("Reboot", $MenuWin) $WinShutdown = GUICtrlCreateMenuItem("Shutdown", $MenuWin) $MenuHelp = GUICtrlCreateMenu("Help") $MenuHelpFile = GUICtrlCreateMenuItem("Help", $MenuHelp) $MenuAbout = GUICtrlCreateMenuItem("About", $MenuHelp) $Exit = GUICtrlCreateButton("Exit", 77, 370, 46, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetCursor($Exit, 0) GUISetState(@SW_SHOW) ; About GUI Func _AboutGUI() $AboutGUI = GUICreate("About Tools", 186, 139, $WinLeft, $WinTop, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), $MainGUI) $AboutEdit = GUICtrlCreateEdit("", 9, 8, 167, 89, $ES_READONLY) GUICtrlSetData(-1, StringFormat("My About Form")) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $AboutOK = GUICtrlCreateButton("OK", 48, 104, 75, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) EndFunc While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuAbout _AboutGUI() Case $AboutOK GUIDelete($AboutGUI) EndSwitch WEnd This loads in the tray but not even show the maingui window ? Looked at event mode but cant seem to get the messages from the child gui ? Link to comment Share on other sites More sharing options...
Alek Posted July 19, 2007 Share Posted July 19, 2007 is this what you were looking for?? expandcollapse popup#include <GUIConstants.au3> $WinTop = @DesktopHeight / 2 ; Y coord $WinLeft = @DesktopWidth / 2 ; X coord ; Main GUI $MainGUI = GUICreate("Tools", 200, 420, $WinLeft, $WinTop) $MenuFile = GUICtrlCreateMenu("File") $MenuAddtoList = GUICtrlCreateMenuItem("Add Item", $MenuFile) $MenuRemove = GUICtrlCreateMenuItem("Remove Item", $MenuFile) $MenuExit = GUICtrlCreateMenuItem("Exit", $MenuFile) $MenuExtras = GUICtrlCreateMenu("Extras") $MenuAddStart = GUICtrlCreateMenuItem("Add Startup", $MenuExtras) $MenuDelStart = GUICtrlCreateMenuItem("Del Startup", $MenuExtras) $MenuPos = GUICtrlCreateMenuItem("Save Possition", $MenuExtras) $MenuWin = GUICtrlCreateMenu("Computer") $WinReboot = GUICtrlCreateMenuItem("Reboot", $MenuWin) $WinShutdown = GUICtrlCreateMenuItem("Shutdown", $MenuWin) $MenuHelp = GUICtrlCreateMenu("Help") $MenuHelpFile = GUICtrlCreateMenuItem("Help", $MenuHelp) $MenuAbout = GUICtrlCreateMenuItem("About", $MenuHelp) $Exit = GUICtrlCreateButton("Exit", 77, 370, 46, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetCursor($Exit, 0) GUISetState(@SW_SHOW) ; About GUI $AboutGUI = GUICreate("About Tools", 186, 139, $WinLeft, $WinTop, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS),-1, $MainGUI) $AboutEdit = GUICtrlCreateEdit("", 9, 8, 167, 89, $ES_READONLY) GUICtrlSetData(-1, StringFormat("My About Form")) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $AboutOK = GUICtrlCreateButton("OK", 48, 104, 75, 25, 0) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_HIDE) ;creates the about gui and hides it While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $MenuAbout GUISetState(@SW_SHOW,$AboutGUI) ;shows the about gui Case $AboutOK GUISetState(@SW_HIDE,$AboutGUI) ;Hides the about gui EndSwitch WEnd [font="Impact"]Never fear, I is here.[/font] Link to comment Share on other sites More sharing options...
figgler Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) Had ago with GUIOnEvent still cant work it out lol expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $WinTop = 100 ; Y coord $WinLeft = 300 ; X coord ; Main GUI $MainGUI = GUICreate("Tools", 200, 420, $WinLeft, $WinTop) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE") $MenuFile = GUICtrlCreateMenu("File") $MenuExit = GUICtrlCreateMenuItem("Exit", $MenuFile) GUISetOnEvent($MenuExit, "CLOSE") $MenuHelp = GUICtrlCreateMenu("Help") $MenuHelpFile = GUICtrlCreateMenuItem("Help", $MenuHelp) $MenuAbout = GUICtrlCreateMenuItem("About", $MenuHelp) GUISetOnEvent($MenuAbout, "AboutGUI") $Exit = GUICtrlCreateButton("Exit", 77, 370, 46, 25, 0) GUISetOnEvent($Exit, "CLOSE") GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetCursor($Exit, 0) GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd ; About GUI Func AboutGUI() $AboutGUI = GUICreate("About Tools", 186, 139, $WinLeft, $WinTop, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS), -1, $MainGUI) $AboutEdit = GUICtrlCreateEdit("", 9, 8, 167, 89, $ES_READONLY) GUICtrlSetData(-1, StringFormat("My About Form")) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $AboutOK = GUICtrlCreateButton("OK", 48, 104, 75, 25, 0) GUISetOnEvent($AboutOK, "CLOSE") GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUISetState(@SW_SHOW) EndFunc Func CLOSE() If @GUI_WinHandle = $MainGUI Then Exit ElseIf @GUI_CTRLID = $Exit Then Exit Else GUIDelete(@GUI_WINHANDLE) EndIf EndFunc Edited July 19, 2007 by figgler Link to comment Share on other sites More sharing options...
figgler Posted July 19, 2007 Author Share Posted July 19, 2007 Thanks for the reply Alek I think I should be using the GuiOnEvent and a function to create my child gui's then use the GUIDelete() to close. Is this right just cant seem to get the events in the above code to fire the functions Oh Well Link to comment Share on other sites More sharing options...
figgler Posted July 19, 2007 Author Share Posted July 19, 2007 (edited) Sorry not tryin to bump my post countbut solvedGUISetOnEvent($GUI_EVENT_CLOSE,"CloseApp1") <-- GuiGUICtrlSetOnEvent($button,"enableit") <-- CtrlTook some searching to find Edited July 19, 2007 by figgler Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now