Bester Posted November 22, 2013 Share Posted November 22, 2013 (edited) Hello, i have a bit of a problem here, and i don`t know what i messed up. Basicly i`m trying to work with 2 GUIs, but i don`t even need to open secound gui and i keep getting message from it, $nMsg[0] = $save_settings_btn and i don`t know what is the problem, since i isolated it with If $nMsg[0] = $save_settings_btn Then If $nMsg[1] = $secondary_gui Then ConsoleWrite("Save button was pushed") ToolTip("Settings were saved", 400, 400) EndIf EndIf here`s the whole loop function expandcollapse popupFunc LoopGUI() Local $nMsg Local $MW While True $nMsg = GUIGetMsg(1) If $nMsg[0] = $GUI_EVENT_CLOSE Then ;when windows is closed do a cleanup for GDI+ If $nMsg[1] = $main_gui Then _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_ImageDispose($clickable_logo) _GDIPlus_Shutdown() Exit Else GUIDelete($secondary_gui) GUICtrlSetState($setting_button, $GUI_ENABLE) EndIf EndIf If $nMsg[0] = $GUI_EVENT_RESTORE Then ;after restoring minimized windows autoit won`t show some graphics RefreshGDIPlus() EndIf If $nMsg[0] = $GUI_EVENT_PRIMARYDOWN Then ;enables clicking on logo InRect() EndIf If $nMsg[0] = $setting_button Then SettingsGUI() GUICtrlSetState($setting_button, $GUI_DISABLE) EndIf If $nMsg[0] = $save_settings_btn Then If $nMsg[1] = $secondary_gui Then ConsoleWrite("Save button was pushed") ToolTip("Settings were saved", 400, 400) EndIf EndIf For $i = 1 To $button[0] ;the main thing, opens VLC If $nMsg[0] = $button[$i] Then $MW = RegRead("HKEY_CURRENT_USER\Software\TV Atris", "MultiWindow") If $MW = 0 Then WinClose("VLC media player") Run($VLC_path & " " & $stream_address[$i]) ConsoleWrite($stream_address[$i] & @CRLF) Else Run($VLC_path & " " & $stream_address[$i]) ConsoleWrite($stream_address[$i] & @CRLF) EndIf EndIf Next WEnd EndFunc ;==>LoopGUI any help would be appreciated, Thank you Edited November 22, 2013 by Bester Link to comment Share on other sites More sharing options...
Valuater Posted November 22, 2013 Share Posted November 22, 2013 See... GUISwitch() in the help file 8) Link to comment Share on other sites More sharing options...
Bester Posted November 22, 2013 Author Share Posted November 22, 2013 Thank you kindly for your help good sir, but somehow i still have a problem with this, i`ve tried to use GUISwitch as you suggested (must admit, i don`t understand it much), but still, after i open my primary gui, i keep getting message from secound gui, which isn`t even opend yet, and it really confuse me, since i don`t see how can this be happening. Link to comment Share on other sites More sharing options...
Bester Posted November 22, 2013 Author Share Posted November 22, 2013 (edited) Okey i found a workaround, i`m not too happy about this but it works, i`ve created a $variable = 0 and when secound GUI is created $variable is set to 1. I found out that if i`m trying to GUIGetMsg button which has not been created yet, it will always return positive. So i`m going to use this $variable to determin when secound GUI has been build. BUT, if anybody got better idea, please let me know! Thanks Edited November 22, 2013 by Bester Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 22, 2013 Moderators Share Posted November 22, 2013 Bester,Have you read the Managing Multiple GUIs tutorial in the Wiki? If not I heartily recommend it. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Bester Posted November 22, 2013 Author Share Posted November 22, 2013 (edited) Yes, i actually did, and that`s exactly what i`ve done, only i wasn`t using Swich but If, and this thing happened. That`s why i was so suprised, that i`m getting answer from the button that wasn`t even created. Edited November 22, 2013 by Bester Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted November 22, 2013 Moderators Solution Share Posted November 22, 2013 Bester,It is difficult to know for sure from the small snippets of code you have given us, but I would hazard a guess that you have declared the variable which will hold the to-be-created button ControlID but not given it a value - in this case Autoit interprets it 0. And guess what is the return value from GUIGetMsg when nothing is happening? When you declare the variable give it a placeholder value (I always use 9999 as I have never yet used ten thousand controls in a GUI) and then it will not fire until you actually create the button and assign the real ControlID to the variable. Remember also to reset the placeholder value if you delete the button. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Bester Posted November 22, 2013 Author Share Posted November 22, 2013 Thank you kindly sir, i found out that it will fire up if i didn`t created the secound gui first, that`s why i`ve done this $variable workaround, but didn`t know the exact reason, now it`s all clear to me. Thank you again Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 22, 2013 Moderators Share Posted November 22, 2013 Bester,Nice to see that the crystal ball still works! M23 Bester 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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