Sign in to follow this  
Followers 0
zvd

GUI checked

4 posts in this topic

Hello, I have a GUI with 3 input fields, and two radio buttons. When $radio_2 is checked, I would like to hide the first two input fields and launch a program on $nok. When $radio_1 is checked, I would like to show all the input fields and launch a different program on $nok. Everything works how I'd like, but I haven't been able figure out how to launch the second program. Any ideas?

Here's some sample code:

Global $GUI_SHOW = 16

Global $GUI_HIDE = 32

Global $GUI_CHECKED = 1

Opt ("GUINotifyMode", 1)

GUICreate("MyGUI", 392, 273, (@DesktopWidth - 392) / 2, (@DesktopHeight - 273) / 2, 0x04CF0000)

GUICreate("A Test", 290, 230, (@DesktopHeight - 290) / 2, (@DesktopHeight - 230) / 2, 0x04CF0000)

GUISetControl("label", "Username:", 20, 10)

GUISetControl("label", "Password:", 20, 60)

GUISetControl("label", "Computer Name:", 20, 110)

$NINPUT = GUISetControl("input", "", 20, 30, 250, 20)

$NINPUT2 = GUISetControl("input", "", 20, 80, 250, 20, "0x0020")

$NINPUT3 = GUISetControl("input", "", 20, 130, 250, 20)

$RADIO_1 = GUISetControl("radio", "Remove", 50, 165, 80, 13)

$RADIO_2 = GUISetControl("radio", "Query", 150, 165, 80, 13)

$NOK = GUISetControl("button", "Send", 50, 190, 80, 20)

$NCANCEL = GUISetControl("button", "Cancel", 150, 190, 80, 20)

GUIShow()

While 1

$MSG = GUIMsg()

Select

Case $MSG = -3

Exit

Case $MSG = $RADIO_2

If GUIRead($MSG) = $GUI_CHECKED Then

GUISetControlEx($NINPUT, $GUI_HIDE)

GUISetControlEx($NINPUT2, $GUI_HIDE)

EndIf

Case $MSG = $RADIO_1

If GUIRead($MSG) = $GUI_CHECKED Then

GUISetControlEx($NINPUT, $GUI_SHOW)

GUISetControlEx($NINPUT2, $GUI_SHOW)

EndIf

EndSelect

test()

Wend

Func test()

If $NOK = GUIRead() Then

MsgBox(0, " Results: ", "Test1 Complete") ;actually launch a program

EndIf

If $NCANCEL = GUIRead() Then Exit

EndFunc test()

Func test2()

If $NOK = GUIRead() Then

MsgBox(0, " Results: ", "Test2 Complete") ;actually launch a different program

EndIf

If $NCANCEL = GUIRead() Then Exit

EndFunc test2()

Share this post


Link to post
Share on other sites



Something like this ?

Global $GUI_SHOW = 16
Global $GUI_HIDE = 32
Global $GUI_CHECKED = 1

Opt ("GUINotifyMode", 1)
GUICreate("MyGUI", 392, 273, (@DesktopWidth - 392) / 2, (@DesktopHeight - 273) / 2, 0x04CF0000)
GUICreate("A Test", 290, 230, (@DesktopHeight - 290) / 2, (@DesktopHeight - 230) / 2, 0x04CF0000) 
GUISetControl("label", "Username:", 20, 10)
GUISetControl("label", "Password:", 20, 60)
GUISetControl("label", "Computer Name:", 20, 110)
$NINPUT = GUISetControl("input", "", 20, 30, 250, 20)
$NINPUT2 = GUISetControl("input", "", 20, 80, 250, 20, "0x0020")
$NINPUT3 = GUISetControl("input", "", 20, 130, 250, 20)
$RADIO_1 = GUISetControl("radio", "Remove", 50, 165, 80, 13)
$RADIO_2 = GUISetControl("radio", "Query", 150, 165, 80, 13)
$NOK = GUISetControl("button", "Send", 50, 190, 80, 20)
$NCANCEL = GUISetControl("button", "Cancel", 150, 190, 80, 20)

GUIShow()

While 1
   
   $MSG = GUIMsg()
   
   Select
      Case $MSG = -3
         Exit
      Case GUIRead() = $RADIO_2
         If GUIRead($RADIO_2) = $GUI_CHECKED Then 
            GUISetControlEx($NINPUT, $GUI_HIDE) 
            GUISetControlEx($NINPUT2, $GUI_HIDE)
         EndIf
      Case GUIRead() = $RADIO_1
         If GUIRead($RADIO_1) = $GUI_CHECKED Then 
            GUISetControlEx($NINPUT, $GUI_SHOW) 
            GUISetControlEx($NINPUT2, $GUI_SHOW)
         EndIf
      Case GUIRead() = $NOK
         if GUIRead($RADIO_1) = $GUI_CHECKED Then test()
         if GUIRead($RADIO_2) = $GUI_CHECKED Then test2()
   EndSelect
Wend

Func test()
      MsgBox(0, " Results: ", "Test1 Complete");actually launch a program 
EndFunc 

Func test2()
      MsgBox(0, " Results: ", "Test2 Complete");actually launch a different program 
EndFunc

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Yes, that's it. Thanks! (How would you get the $ncancel to work though...)

Share this post


Link to post
Share on other sites

Yes, that's it. Thanks! (How would you get the $ncancel to work though...)

You mean when cancel is clicked then exit:

Select
     Case $MSG = -3 or  GUIRead() = $ncancel 
        Exit

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0