Jump to content

Recommended Posts

Posted

Hey guys,

First off, i'm new to this forum... I just started using AutoIt GUI, and here's what i'm trying to do.

I want to set up several checkboxes, but I want users to be able to check only 1 of them at a time. Now I have everything working fine except for the fact that I can't seem to find any reference on how to make it so that you can only check 1.

Please point me in the right direction, I would appreciate it a lot !

:)

I can only help 1 person a day...Today's just not your day...and Tomorrow doesn't look good either... :)

Posted

Ok, i guess chalk this one up to being a newbie at this GUI :)

Thanks for the info !!

I can only help 1 person a day...Today's just not your day...and Tomorrow doesn't look good either... :)

Posted

Ok... I tried the radio button... It only lets me pick 1 at a time.. that's perfect... But lets say I want to be able to UN-Select a Radio button so that none of them are on ???

Any hints ??

Much appreciated !

I can only help 1 person a day...Today's just not your day...and Tomorrow doesn't look good either... :)

Posted (edited)

Edit:

Better example!

#include <GuiConstants.au3>

GuiCreate('', 130, 130)

$radio0 = GuiCtrlCreateRadio('None', 0, 0, 100)
$radio1 = GuiCtrlCreateRadio('Radio 1', 0, 20, 100)
$radio2 = GuiCtrlCreateRadio('Radio 2', 0, 40, 100)

GuiSetState()

While 1
    $i_Msg = GuiGetMsg()

    Select
        case $i_msg = $radio0
            GuiCtrlSetState($radio0, $GUI_UNCHECKED)
        Case $i_Msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
Edited by Saunders
Posted

Cool !! Thanks for the example, I know which direction to take now :)

I can only help 1 person a day...Today's just not your day...and Tomorrow doesn't look good either... :)

Posted

This may sound like a stupid question once again... but hey, i'm learning :)

I think i worked out my problem with the checkboxes with the help of Saunders' example... However now what seems to happen is when i put a check in the checkbox i want, which is supposed to call a function, the thing just goes bananas on me, checking and un-checking itself like crazy ....

Func Follow1()
         If $MyTarget1 <> "" Then
          Send("/target ");
          Send($MyTarget1);
          Send("{RETURN}");
         Else
           MsgBox(4096, "ERROR", "There is no player name defined in box #1", 10)
         EndIf

EndFunc

Now my question is, when someone checks a box, its supposed to only perform this function once right ??? Or will it keep repeating this function until the box is unchecked ???

Is there any way to check if the box is checked or not with an IF statement ???

Am I making any sense with my n00b non-sense ???

:D

I can only help 1 person a day...Today's just not your day...and Tomorrow doesn't look good either... :)

Posted

If GuiCtrlRead ( $checkbox ) = $GUI_CHECKED and $checked = "no" then checked = "yes"

do it like that so it doesn't go crazy

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Posted

How about this?! :)

#include <GuiConstants.au3>

GuiCreate('', 130, 130)

$check_b_1 = GuiCtrlCreateCheckbox('Checkbox 1', 0, 0, 100)
$check_b_2 = GuiCtrlCreateCheckbox('Checkbox 2', 0, 20, 100)
$check_b_3 = GuiCtrlCreateCheckbox('Checkbox 3', 0, 40, 100)

GuiSetState()

While 1
    $i_Msg = GuiGetMsg()

    Select
        case $i_msg >= $check_b_1 AND $i_msg <= $check_b_3
            If GUICtrlRead($i_msg) = $GUI_CHECKED Then
               For $i = $check_b_1 To $check_b_3
                  If $i_msg <> $i Then GuiCtrlSetState($i, $GUI_UNCHECKED)
               Next
               If $i_msg = $check_b_1 Then
                  Follow1()
               ElseIf $i_msg = $check_b_2 Then
                  Follow2()
               ElseIf $i_msg = $check_b_3 Then
                  Follow3()
               EndIf
            EndIf
            
        Case $i_Msg = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect
WEnd
Posted

Thanks for the help guys !! Much Appreciated !!

:)

I can only help 1 person a day...Today's just not your day...and Tomorrow doesn't look good either... :)

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
  • Recently Browsing   0 members

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