Jump to content
Sign in to follow this  
Tagor

Action on click on a radiobutton

Recommended Posts

Run Notepad when 2nd radio clicked:

#include <GuiConstants.au3>

GuiCreate("", 100, 60)

$radio0 = GuiCtrlCreateRadio("None", 0, 0, 100)

$radio1 = GuiCtrlCreateRadio("Run Notepad", 0, 20, 100)

GuiSetState()

While 1

    $msg = GuiGetMsg()

    Select

        case $msg = $radio1

            Run("Notepad")

        Case $msg = $GUI_EVENT_CLOSE

            ExitLoop

    EndSelect

WEnd

Share this post


Link to post
Share on other sites

Weird, then I don't get why this doesn't work:

Instead of Run("Notepad"):

GuiSetState ($radio0, $WS_ENABLE)

Share this post


Link to post
Share on other sites

Weird, then I don't get why this doesn't work:

Instead of Run("Notepad"):

GuiSetState ($radio0, $WS_ENABLE)

<{POST_SNAPBACK}>

Why you want to do that ? The control IS enabled!

And it should be GuiCtrlSetState ($radio0, $GUI_ENABLE)

Maybe if you explain wat you want to do we can help you!

Edited by TuMbLeWeEd

Share this post


Link to post
Share on other sites

Then try: GuiCtrlSetState($radio0, $GUI_ENABLE) or GuiCtrlSetState($radio0, $GUI_CHECKED) (to work on it...).

Share this post


Link to post
Share on other sites

Sorry for not being clear. I want to make the following thing; all radiobuttons are enabled, if someone selects one of the radiobuttons, a submit button should become enabled to submit the values of the radiobuttons.

Share this post


Link to post
Share on other sites

Sorry for not being clear. I want to make the following thing; all radiobuttons are enabled, if someone selects one of the radiobuttons, a submit button should become enabled to submit the values of the radiobuttons.

<{POST_SNAPBACK}>

This is very easy to do. I am trying to look for some old code that I had that will do this. Save me the time of having to rethink everything and type it again hehe.

Give me a few and hopefully we will get this resolved.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
GUICreate("My GUI radio") 

$radio1 = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20)

$exit = GUICtrlCreateButton ("exit",  10, 40, 120, 20)

GUISetState ()  

While 1

    $msg = GUIGetMsg()
    
 If $msg = $exit Then 
exit
endif

 If GUICtrlRead($radio1) = 1 Then 
MsgBox(4096, "Test", "tadaa") 
sleep(2000)
Exit
endif

Wend

I had to add the sleep(2000) and Exit in there so the box could actually be closed.

Without it the msgbox couldnt be closed because the loop was still seeing the button checked.

FYI radio button checked =1

Not checked =3

when using guiread

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...