Jump to content

Radio & General Help


Recommended Posts

Hi!

Ok this is for my time doing a GUI within Autoit and I may be slightly thick here, however I need some help to get me started.

I have created a GUI that looks like this (as you will see I have created this from Koda - good tool by the way!) - scroll down

#include <GUIConstants.au3>

SplashTextOn("Information!", "User Administration Initializing", 400, 50, 1, 1, 4, "", 10)

sleep(3000)

splashoff()

; == GUI generated with Koda ==);

$Form1 = GUICreate("AForm1", 354, 202, 331, 214)

GUICtrlCreateLabel("ITT User Administration Package", 120, 16, 160, 25)

$Pic1 = GUICtrlCreatePic("U:\Documents\CYCLogo.JPG", 16, 8, 68, 36, BitOR($SS_NOTIFY,$WS_GROUP))

$Radio1 = GUICtrlCreateRadio("New User", 80, 72, 113, 17)

$Radio2 = GUICtrlCreateRadio("Modify User", 80, 96, 113, 17)

$Radio3 = GUICtrlCreateRadio("Mark for Deletaion", 80, 120, 113, 17)

$Radio4 = GUICtrlCreateRadio("Purge Users", 80, 144, 113, 17)

$Button1 = GUICtrlCreateButton("OK", 256, 72, 75, 25, 0)

$Button2 = GUICtrlCreateButton("Cancal", 256, 96, 75, 25, 0)

$Button3 = GUICtrlCreateButton("About", 256, 120, 75, 25, 0)

GUICtrlCreateLabel("ITT Customer Support 2006", 128, 184, 135, 17)

GUISetState(@SW_SHOW)

While 1

$msg = GuiGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

ExitLoop

Case Else

;;;;;;;

EndSelect

WEnd

I have written some code, so what I want to happen is if the person select "New User" and presses OK it will run that code (or function), if they select "Purge Users" and OK it runs other code! If the person presses cancal it quits and if they press About another GUI appears. mI have searched for a simple way of doing this and have not been sucsesfull. If somone could show me the basic I would appreciate it

Thanks is advance JJB

:)

Link to comment
Share on other sites

maybe this could help

#include <GUIConstants.au3>
SplashTextOn("Information!", "User Administration Initializing", 400, 50, 1, 1, 4, "", 10)
sleep(3000)
splashoff()
; == GUI generated with Koda ==);
$Form1 = GUICreate("AForm1", 354, 202, 331, 214)
GUICtrlCreateLabel("ITT User Administration Package", 120, 16, 160, 25)
$Pic1 = GUICtrlCreatePic("U:\Documents\CYCLogo.JPG", 16, 8, 68, 36, BitOR($SS_NOTIFY,$WS_GROUP))
$Radio1 = GUICtrlCreateRadio("New User", 80, 72, 113, 17)
$Radio2 = GUICtrlCreateRadio("Modify User", 80, 96, 113, 17)
$Radio3 = GUICtrlCreateRadio("Mark for Deletaion", 80, 120, 113, 17)
$Radio4 = GUICtrlCreateRadio("Purge Users", 80, 144, 113, 17)
$Button1 = GUICtrlCreateButton("OK", 256, 72, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Cancal", 256, 96, 75, 25, 0)
$Button3 = GUICtrlCreateButton("About", 256, 120, 75, 25, 0)
GUICtrlCreateLabel("ITT Customer Support 2006", 128, 184, 135, 17)
GUISetState(@SW_SHOW)
While 1
$msg = GuiGetMsg()
Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Button1
        If BitAnd(GUICtrlRead($Radio1),$GUI_CHECKED) = $GUI_CHECKED Then
            $new = InputBox("New User", "Please type in a name")
            MsgBox(64,"New User", $new )
        ElseIf BitAnd(GUICtrlRead($Radio2),$GUI_CHECKED) = $GUI_CHECKED Then
            $new = InputBox("Modify User", "Please type in a name")
            MsgBox(64,"Modify User", $new )
        ElseIf BitAnd(GUICtrlRead($Radio3),$GUI_CHECKED) = $GUI_CHECKED Then
            $new = InputBox("Delete User", "Please type in a name")
            MsgBox(64,"Delete User", $new )
        Else
            MsgBox(64,"Purge Users", "Now Purging all users " )
        EndIf
    Case $msg = $Button2
        Exit
    Case $msg = $Button3
        MsgBox(64,"About", "This program............... " & @CRLF & @CRLF & " Author... me         ")
Case Else
;;;;;;;
EndSelect
WEnd

8)

NEWHeader1.png

Link to comment
Share on other sites

  • Moderators

There's an example of how to do this in the help file under GUICtrlCreateButton()

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

  • Moderators

you must need your coffee still.. ( i know i do )

Good Morning

8)

LOL, don't drink coffee... but it wasn't directed at reading the 'radio' specifically, it more of... do some homework.

1. I want to click a button and take an action: GUICtrlCreateButton()

2. I want it to take an action if Radio is clicked: If / Then - However... there isn't a good example on how to read if the Radio was checked, so your post was quite valid... It wasn't there when I posted mine... But it was more out to say... should read the help file first... Using Koda (drag and drop) and saying this is what I want to do, doesn't really show effort to me. :)

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

LOL, don't drink coffee... but it wasn't directed at reading the 'radio' specifically, it more of... do some homework.

1. I want to click a button and take an action: GUICtrlCreateButton()

2. I want it to take an action if Radio is clicked: If / Then - However... there isn't a good example on how to read if the Radio was checked, so your post was quite valid... It wasn't there when I posted mine... But it was more out to say... should read the help file first... Using Koda (drag and drop) and saying this is what I want to do, doesn't really show effort to me. :)

Gotcha... I usually agree with what you said...

i just noticed it was his first post and thats not bad for a newbie

8)

NEWHeader1.png

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...