Jump to content

How to....


Komawoyo
 Share

Recommended Posts

is it possible to have a checked radio be in the same spot where you left it??

also....

!!Problem: No values are returned

#include <GUIConstants.au3>

Dim $R1I1, $R1I2, $R1I3, $R2I1, $R2I2, $R2I3
Dim $VR1I1, $VR1I2, $VR1I3, $VR2I1, $VR2I2, $VR2I3
Dim $radio_1, $radio_2, $radio_3, $radio_4
Dim $RECORD1, $RECORD2

HotKeySet("{ESC}", "TERMINATE")
HotKeySet("{F1}", "SHOW")
GUICreate("Test", 100, 50, 700, 200)

$New = GUICtrlCreateButton( "New/Edit",0, 20)
$Reset = GUICtrlCreateButton("Reset", 55, 20)[center][/center]
GUISetState()

while 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
    Case $msg = $New
        _INFO()
    Case $msg = $Reset
        _Reset()
    EndSelect
WEnd

Func _Info()
    $INFO = GUICreate("Info", 400, 400)
    $Set = GUICtrlCreateButton("Ok", 20,100, 50, 20)
    $R1I1 = GUICtrlCreateInput($VR1I1, 90,20, 50, 20)
    $R1I2 = GUICtrlCreateInput($VR1I2, 140,20, 50, 20)
    $R1I3 = GUICtrlCreateInput($VR1I3, 190,20, 50, 20)
    $R2I1 = GUICtrlCreateInput($VR2I1, 90,40, 50, 20)
    $R2I2 = GUICtrlCreateInput($VR2I2, 140,40, 50, 20)
    $R2I3 = GUICtrlCreateInput($VR2I3, 190,40, 50, 20)
GUICtrlCreateLabel("# of Inputs", 10, 0)
;radios
$radio_1 = GUICtrlCreateRadio ("2x", 0, 20, 40, 20)
$radio_2 = GUICtrlCreateRadio ("3x", 40, 20, 40, 20)
GUIStartGroup()
$radio_3 = GUICtrlCreateRadio ("2x", 0, 40, 40, 20)
$radio_4 = GUICtrlCreateRadio ("3x", 40, 40, 40, 20)
GUIStartGroup()
GUICtrlSetState($Radio_1, $GUI_CHECKED)
GUICtrlSetState($Radio_3, $GUI_CHECKED)
GUISetState()
While 2
    $msg2 = GUIGetmsg()
    Select
    Case $msg2 = $GUI_EVENT_CLOSE
        GUIDelete($INFO)
        Return
    Case $msg2 = $Set
        _READ()
        GUIDelete($INFO)
    Return
EndSelect
    If $msg = $radio_1 Then
        $record1 = StringFormat($VR1I1 & $VR1I2)
    ElseIf $msg = $radio_2 Then
        $record1 = StringFormat($VR1I1 & $VR1I2 & $VR1I3)
    EndIf
    If $msg = $radio_3 Then
        $record2 = StringFormat($VR2I1 & $VR2I2)
    ElseIf $msg = $radio_4 Then
        $record2 = StringFormat($VR2I1 & $VR2I2 & $VR2I3)
    EndIf
    
WEnd
EndFunc
Func _Read()
    $VR1I1 = GUICtrlRead($R1I1)
    $VR1I2 = GUICtrlRead($R1I2)
    $VR1I3 = GUICtrlRead($R1I3)
    $VR2I1 = GUICtrlRead($R2I1)
    $VR2I2 = GUICtrlRead($R2I2)
    $VR2I3 = GUICtrlRead($R2I3) 
EndFunc
;RESET VALUES
Func _Reset()
    $VR1I1 = ""
    $VR1I2 = ""
    $VR1I3 = ""
    $VR2I1 = ""
    $VR2I2 = ""
    $VR2I3 = ""
EndFunc
Func Show()
    MsgBox( 0, "Test", $RECORD1 & @lf & $RECORD2)
EndFunc
Func TERMINATE()
    Exit
EndFunc
Link to comment
Share on other sites

is it possible to have a checked radio be in the same spot where you left it??

also....

!!Problem: No values are returned

To get and save the checked state of radio buttons use:

$iState = BitAnd(GuiCtrlGetState($CtrlID), $GUI_CHECKED)

- or -

$iState = ControlCommand($WinTitle, $WinText, $CtrlID, "IsChecked")

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

To get and save the checked state of radio buttons use:

$iState = BitAnd(GuiCtrlGetState($CtrlID), $GUI_CHECKED)

- or -

$iState = ControlCommand($WinTitle, $WinText, $CtrlID, "IsChecked")

:)

thank you very much

is there a way to reset it back to default when i hit my reset button?

Edited by Komawoyo
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...