J0ker Posted February 20, 2007 Posted February 20, 2007 Hey guys !I have been working with autoit during the last years and I just realised that I never used any Gui ! I need one for my script now but I really have no clue how to do it ( Im not sure if I need a gui or not for the thing I want to achieve). I want to make a box like this:Do I need to use Gui coding or I could work around? If yes, can anyone help me making this?Thanks alot !
Shevilie Posted February 20, 2007 Posted February 20, 2007 If you have scite look in Tools -> GUI Builder Or Simply start looking in all the lovely GUI examples in the helpfile Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
J0ker Posted February 20, 2007 Author Posted February 20, 2007 Thx! I made one but now I encounter some problem. 1. I have 2 buttons, what should I write to make an action when someone click on them? Wich value should it return? $Button_12 = GuiCtrlCreateButton("Done", 280, 70, 100, 30) $Button_13 = GuiCtrlCreateButton("Need help?", 280, 110, 100, 30) oÝ÷ Ûb!j÷¹v'ßz·§¶ÊÚv*Ò0j{w¡ûazkhmè§¶¬jg ®©jwmí¨¶«²)íëè+¢êp«l¥v,+×iب³mø¶¶«jwQiب³Ýt¶¶«jëh×6 $Radio_2 = GuiCtrlCreateRadio("Me", 10, 100, 70, 20) $Radio_3 = GuiCtrlCreateRadio("You", 10, 130, 90, 20) $Radio_4 = GuiCtrlCreateRadio("huh?", 10, 160, 120, 20) $Radio_9 = GuiCtrlCreateRadio("No", 170, 100, 60, 30) $Radio_10 = GuiCtrlCreateRadio("Yes", 170, 140, 80, 30)
Shevilie Posted February 20, 2007 Posted February 20, 2007 From help file expandcollapse popup;------------------------------------------------------------------------------------- ; Example - Press the button to see the value of the radio boxes ; The script also detects state changes (closed/minimized/timeouts, etc). #include <GUIConstants.au3> Opt("GUICoordMode", 1) GUICreate("Radio Box Demo", 400,280) ; Create the controls $button_1 = GUICtrlCreateButton ("B&utton 1", 30, 20, 120, 40) $group_1 = GUICtrlCreateGroup ("Group 1", 30, 90, 165, 160) GUIStartGroup() $radio_1 = GUICtrlCreateRadio ("Radio &0", 50, 120, 70, 20) $radio_2 = GUICtrlCreateRadio ("Radio &1", 50, 150, 60, 20) $radio_3 = GUICtrlCreateRadio ("Radio &2", 50, 180, 60, 20) ; Init our vars that we will use to keep track of GUI events $radioval1 = 0 ; We will assume 0 = first radio button selected, 2 = last button $radioval2 = 2 ; Show the GUI GUISetState () ; In this message loop we use variables to keep track of changes to the radios, another ; way would be to use GUICtrlRead() at the end to read in the state of each control While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE MsgBox(0, "", "Dialog was closed") Exit Case $msg = $GUI_EVENT_MINIMIZE MsgBox(0,"", "Dialog minimized",2) Case $msg = $GUI_EVENT_MAXIMIZE MsgBox(0,"", "Dialog restored",2) Case $msg = $button_1 MsgBox(0, "Default button clicked", "Radio " & $radioval1 ) Case $msg >= $radio_1 AND $msg <= $radio_3 $radioval1 = $msg - $radio_1 EndSelect WEnd Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Shevilie Posted February 20, 2007 Posted February 20, 2007 And another from the helpfile... I'll recommend you look through ALL GUI help expandcollapse popup#include <GUIconstants.au3> Opt("GUICoordMode", 1) GUICreate("Radio Box Grouping Demo", 400,280) ; Create the controls $button_1 = GUICtrlCreateButton ("B&utton 1", 30, 20, 120, 40) $group_1 = GUICtrlCreateGroup ("Group 1", 30, 90, 165, 160) GUIStartGroup() $radio_1 = GUICtrlCreateRadio ("Radio &0", 50, 120, 70, 20) $radio_2 = GUICtrlCreateRadio ("Radio &1", 50, 150, 60, 20) $radio_3 = GUICtrlCreateRadio ("Radio &2", 50, 180, 60, 20) GUIStartGroup() $radio_4 = GUICtrlCreateRadio ("Radio &A", 120, 120, 70, 20) $radio_5 = GUICtrlCreateRadio ("Radio &B", 120, 150, 60, 20) $radio_6 = GUICtrlCreateRadio ("Radio &C", 120, 180, 60, 20) GUIStartGroup() $input_1 = GUICtrlCreateInput ("Input 1", 200, 20, 160, 30) $input_2 = GUICtrlCreateInput ("Input 2", 200, 70, 160, 30) ; Set the defaults (radio buttons clicked, default button, etc) GUICtrlSetState($radio_1, $GUI_CHECKED) GUICtrlSetState($radio_6, $GUI_CHECKED) GUICtrlSetState($button_1, $GUI_FOCUS + $GUI_DEFBUTTON) ; Init our vars that we will use to keep track of radio events $radioval1 = 0 ; We will assume 0 = first radio button selected, 2 = last button $radioval2 = 2 GUISetState () ; In this message loop we use variables to keep track of changes to the radios, another ; way would be to use GUICtrlRead() at the end to read in the state of each control. Both ; methods are equally valid While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $button_1 MsgBox(0, "Button", "Radio " & $radioval1 & @LF & "Radio " & Chr($radioval2 + Asc("A")) & @LF & GUICtrlRead($input_1) & @LF & GUICtrlRead($input_2)) Case $msg = $radio_1 OR $msg = $radio_2 OR $msg = $radio_3 $radioval1 = $msg - $radio_1 Case $msg = $radio_4 OR $msg = $radio_5 OR $msg = $radio_6 $radioval2 = $msg - $radio_4 EndSelect WEnd Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now