Silas Posted September 26, 2018 Posted September 26, 2018 Hello everone, I'm creating a GUI, with radios. Radio's working, everything is fine. Here's a part of my script: $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button_Transfer If GUICtrlRead($Input)= Not "" And $Einde = False Then Transfer() Case $Radio1 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio6,1) Case $Radio2 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Case $Radio3 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Case $Radio4 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Case $Radio5 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio2,1) Case $Radio6 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio1,1) Case $Radio7 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Case $Radio8 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) ; Case $Button_Undo ; Something Case $Button_Return MsgBox(4, "Waarschuwing", "Als je teruggaat, verlies je alle voortgang." & @CRLF & "Wil je doorgaan?") Start() EndSwitch My problem: If I load the complete script with only 2 players, Radio 3,4,5 and 6 aren't loaded, and thus the script gives an error while loading the script above. I can and have used IsDeclared(), but how can I insert the IsDeclared part into this swith? Something like Case $Radio2 if IsDeclared("PLayer3")=1 If $SpelersOver=2 And $Einde=0 Then GUICtrlSetState($Radio5,1) Thanks in advance, Silas
water Posted September 26, 2018 Posted September 26, 2018 You must switch to Select My UDFs and Tutorials: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Silas Posted September 27, 2018 Author Posted September 27, 2018 Thank's for your reply, but how is Select different from Switch?
water Posted September 27, 2018 Posted September 27, 2018 The condition to check can only be defined once for Switch and hence is the same for all Case statements, whereas the condition can be different for each Case statement for Select. My UDFs and Tutorials: Reveal hidden contents UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Moderators JLogan3o13 Posted September 27, 2018 Moderators Posted September 27, 2018 To add on to that, if you crack open the help file and compare the example for Switch to the one for Select, the differences should be immediate and plain to see. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
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