Jump to content

Radio Button Click Checked Click Unchecked?


Recommended Posts

Hey Guys,

I have tried several ways to get a feature to work but cannot. What I would like to do is to click the radio button and have it stay checked until clicked again and have change it's state to unchecked.

Any help appreciated.

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Remedy Ticket Tool", 440, 297, 192, 125)
$Group1 = GUICtrlCreateGroup("Please Paste Ticket #'s", 8, 8, 130, 249)
$Input1 = GUICtrlCreateInput("", 17, 26, 111, 221, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Copy From Here To Remedy", 152, 8, 281, 249)
$Input2 = GUICtrlCreateInput("", 161, 26, 261, 221, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Radio1 = GUICtrlCreateRadio("Add Helpdesk# and ""or""", 8, 264, 137, 25)
$Button1 = GUICtrlCreateButton("&Ok", 288, 264, 65, 25)
$Button2 = GUICtrlCreateButton("&Cancel", 368, 264, 65, 25)
GUISetState(@SW_SHOW)
While 1
    $msg = GuiGetMsg()
    $msg1 = $GUI_EVENT_PRIMARYDOWN
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button2
        ExitLoop
    Case $msg = $Radio1 and $GUI_CHECKED
        Rad1CH()
    Case $msg = $Radio1 and $GUI_UNCHECKED
        Rad1UN()
    Case Else
    EndSelect
WEnd
Exit

;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Functions~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
Func Rad1CH()
    GUICtrlSetState(9, $GUI_UNCHECKED)
        MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is unChecked.')
EndFunc
        
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~;
Func Rad1UN()
    GUICtrlSetState(9, $GUI_CHECKED)
        MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
EndFunc

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Link to comment
Share on other sites

  • Moderators

#include <GUIConstants.au3>
; == GUI generated with Koda ==
$Form1 = GUICreate("Remedy Ticket Tool", 440, 297, 192, 125)
$Group1 = GUICtrlCreateGroup("Please Paste Ticket #'s", 8, 8, 130, 249)
$Input1 = GUICtrlCreateInput("", 17, 26, 111, 221, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group2 = GUICtrlCreateGroup("Copy From Here To Remedy", 152, 8, 281, 249)
$Input2 = GUICtrlCreateInput("", 161, 26, 261, 221, -1, $WS_EX_CLIENTEDGE)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Radio1 = GUICtrlCreateRadio("Add Helpdesk# and ""or""", 8, 264, 137, 25)
$Button1 = GUICtrlCreateButton("&Ok", 288, 264, 65, 25)
$Button2 = GUICtrlCreateButton("&Cancel", 368, 264, 65, 25)
GUISetState(@SW_SHOW)
Local $1stClick = 1
While 1
    $msg = GuiGetMsg()
    $msg1 = $GUI_EVENT_PRIMARYDOWN
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button2
        ExitLoop
    Case $msg = $Radio1
        If BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED And $1stClick = 1 Then
            $1stClick = 2
        ElseIf BitAND(GUICtrlRead($Radio1), $GUI_CHECKED) = $GUI_CHECKED And $1stClick = 2 Then
            GUICtrlSetState($Radio1, $GUI_UNCHECKED)
            $1stClick = 1
        EndIf
    EndSelect
WEnd
Exit
It ain't purty :D

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Sweet ty. I was trying to figure this out but couldn't get there. What would you do with the pretty version? You don't have to do it but just let me know what you do to make it pretty.

Thanks dood you rock!

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Link to comment
Share on other sites

How do I test the contents of an edit box to popup a msg if the box is empty? :D

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Link to comment
Share on other sites

Im not sure, but maybe something with that

$readinput = GUICtrlRead($INputBoxNameHere)

If $readinput = "" Then

Msgbox( 1, "Error", "The inputbox is empty! Oh noeses!")

Not sure how to use that guictrlread thingy though

Link to comment
Share on other sites

How do I test the contents of an edit box to popup a msg if the box is empty? :D

Hi,

Edit = Input ? If GUICtrlRead(...) = "" Then MsgBox(...)

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Edit = Edit :D

GUICtrlCreateEdit

--------------------------------------------------------------------------------

Creates an Edit control for the GUI.

GUICtrlCreateEdit ( "text", left, top [, width [, height [, style [, exStyle]]]] )

Thanks guys!

Edited by Neoborn

~Projects~1. iPod Ejector 1.0 - Tool Used To Eject iPod in Windows - Uses DevEject.exe :P2. SmartFTP Close Popup Tool - Closes reminders from freeware SmartFTP.~Helpful Links For New Users~1. LXP's Learning AutoIT PDF Guide - <<< Go here for a PDF Guide on learning AutoIT from the ground up!<<<2. AutoIt 1-2-3 <<<Want to learn more about AutoIT quickly? Go Here<<<3. How To Install The Beta And Production Versions Of AutoIT / SciteAutoIT

Link to comment
Share on other sites

Hi,

the same as InputBox and many other Controls.

#include <GUIConstants.au3>

GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered

$myedit=GUICtrlCreateEdit ("", 176,32,121,97,$ES_AUTOVSCROLL+$WS_VSCROLL)

GUISetState ()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
    If GUICtrlRead($myedit) = "" Then
        GUICtrlSetData ($myedit, "Yeah",1)
        MsgBox(0,"","works")
    EndIf
Wend

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...