I would like to have a GUI that has several general options, but also maybe when i click and advanced tab i can put checks into check boxes to activate the additional features.
I am not sure how I would read in if the check box is checked and or what is the most efficient way to process my code.
While 1 Select Case $nMsg = $Radio1 ; ======================= Section 1 ================================== radios($off) ;Greys out the radio buttons. Do ` ; ---- MAIN LOOP ----- $nMsg = GUIGetMsg() If $nMsg = $Button1 Then GUICtrlSetState($Button1, $GUI_DISABLE) program1($norbs) EndIf Until $nMsg = $Button2 Or $nMsg = $GUI_EVENT_CLOSE Or $status = "Done" Closeout($norbs) Case $nMsg = $Radio2 ;===================== Section 2 ========================= radios($off) ; Greys out the radio buttons. Do ; ---- MAIN LOOP ----- $nMsg = GUIGetMsg() If $nMsg = $Button1 Then GUICtrlSetState($Button1, $GUI_DISABLE) program2($norbs) EndIf Until $nMsg = $Button2 Or $nMsg = $GUI_EVENT_CLOSE Or $status = "Done" Closeout($norbs) EndSelect If $nMsg = $GUI_EVENT_CLOSE Then ExitLoop EndIf WEnd
What this section of code does is waits for you to select a radio button. Once you do that it will wait for you to click button 1 before it does anything.
The problem I am having is if i want different versions or more advanced options I don't know how to write it into my code without having so much duplicate code its ridiculous. Section 1 and Section 2 are nearly identical!! in function but because i don't know how to mesh the code in section 1 and section 2 it stays separate.
What i would like is to have one case statement with precise controls that funneled down the GuiGetmsg inputs to the correct actions.
I keep thinking there is a simple way to watch for key or mouse inputs and recording them into the correct variables without having tons of duplicate code.
So for example in my previous code does anyone have an idea how i could mesh in the ability to read check boxes for advanced settings on the programs1() and 2 functions?
or for that matter how does the check box feature work in the gui? is it just a simple $nMsg = GUIGetMsg() ? but not sure how to assign it to a variable?
I am still learning how to code gui inputs and such. Is there a place i can learn the best practices on coding behind the scenes of a gui?
Hope i provided enough information.
Edited by thawee, 23 April 2010 - 01:02 PM.