ArxBzFhblxphS Posted June 20, 2009 Share Posted June 20, 2009 (edited) Edited August 9, 2009 by Thanubis Link to comment Share on other sites More sharing options...
GEOSoft Posted June 20, 2009 Share Posted June 20, 2009 (edited) expandcollapse popupOpt("MustDeclareVars", 1) Global $aRadio[61] = [10] GUICreate("Title", 200, 200) Local $go = GUICtrlCreateButton("Go", 0, 150, 200, 50, 0x0F00) Local $tab = GUICtrlCreateTab(0, 0, 200, 150) GUICtrlCreateTabItem("One") GUIStartGroup() $aRadio[01] = GUICtrlCreateRadio("01", 9, 33, 180, 20) $aRadio[02] = GUICtrlCreateRadio("02", 9, 53, 180, 20) $aRadio[03] = GUICtrlCreateRadio("03", 9, 73, 180, 20) $aRadio[04] = GUICtrlCreateRadio("04", 9, 93, 180, 20) $aRadio[05] = GUICtrlCreateRadio("05", 9, 113, 180, 20) GUIStartGroup() GUICtrlCreateTabItem("Two") GUIStartGroup() $aRadio[06] = GUICtrlCreateRadio("06", 9, 33, 180, 20) $aRadio[07] = GUICtrlCreateRadio("07", 9, 53, 180, 20) $aRadio[08] = GUICtrlCreateRadio("08", 9, 73, 180, 20) $aRadio[09] = GUICtrlCreateRadio("09", 9, 93, 180, 20) $aRadio[10] = GUICtrlCreateRadio("10", 9, 113, 180, 20) GUIStartGroup() GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() Select Case $msg = -3 Exit Case $msg = $go For $i = 1 To 60 If GUICtrlRead($aRadio[$i]) = 1 Then MsgBox(0,"",ControlGetText("Title", "", $aRadio[$i])) Next EndSelect WEnd Edit: Forgot the code tags ... AGAIN! Edited June 20, 2009 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 20, 2009 Moderators Share Posted June 20, 2009 Thanubis, Take a look at this:expandcollapse popupOpt("MustDeclareVars", 1) Global $aRadio[11] = [11] GUICreate("Title", 200, 200) Local $go = GUICtrlCreateButton("Go", 0, 150, 200, 50, 0x0F00) Local $tab = GUICtrlCreateTab(0, 0, 200, 150) GUICtrlCreateTabItem("One") GUIStartGroup() $aRadio[01] = GUICtrlCreateRadio("01", 9, 33, 180, 20) $aRadio[02] = GUICtrlCreateRadio("02", 9, 53, 180, 20) $aRadio[03] = GUICtrlCreateRadio("03", 9, 73, 180, 20) $aRadio[04] = GUICtrlCreateRadio("04", 9, 93, 180, 20) $aRadio[05] = GUICtrlCreateRadio("05", 9, 113, 180, 20) GUIStartGroup() GUICtrlCreateTabItem("Two") GUIStartGroup() $aRadio[06] = GUICtrlCreateRadio("06", 9, 33, 180, 20) $aRadio[07] = GUICtrlCreateRadio("07", 9, 53, 180, 20) $aRadio[08] = GUICtrlCreateRadio("08", 9, 73, 180, 20) $aRadio[09] = GUICtrlCreateRadio("09", 9, 93, 180, 20) $aRadio[10] = GUICtrlCreateRadio("10", 9, 113, 180, 20) GUIStartGroup() GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() Select Case $msg = -3 Exit EndSelect For $i = 1 To 10 If $msg = $aRadio[$i] And GUICtrlRead($aRadio[$i]) = 1 Then For $j = 1 To 10 GUICtrlSetState($aRadio[$j], 4) Next GUICtrlSetState($aRadio[$i], 1) EndIf Next WEnd You can see the radio being reset when you change tabs, but at least it changes! M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Skruge Posted June 20, 2009 Share Posted June 20, 2009 The tabs automatically put them in separate groups, so one button is selectable from each tab, and GUIStartGroup isn't needed. Try this instead to reset the rest when one is selected.expandcollapse popupOpt("MustDeclareVars", 1) Global $aRadio[61] = [10] GUICreate("Title", 200, 200) Local $go = GUICtrlCreateButton("Go", 0, 150, 200, 50, 0x0F00) Local $tab = GUICtrlCreateTab(0, 0, 200, 150) GUICtrlCreateTabItem("One") $aRadio[01] = GUICtrlCreateRadio("01", 9, 33, 180, 20) $aRadio[02] = GUICtrlCreateRadio("02", 9, 53, 180, 20) $aRadio[03] = GUICtrlCreateRadio("03", 9, 73, 180, 20) $aRadio[04] = GUICtrlCreateRadio("04", 9, 93, 180, 20) $aRadio[05] = GUICtrlCreateRadio("05", 9, 113, 180, 20) GUICtrlCreateTabItem("Two") $aRadio[06] = GUICtrlCreateRadio("06", 9, 33, 180, 20) $aRadio[07] = GUICtrlCreateRadio("07", 9, 53, 180, 20) $aRadio[08] = GUICtrlCreateRadio("08", 9, 73, 180, 20) $aRadio[09] = GUICtrlCreateRadio("09", 9, 93, 180, 20) $aRadio[10] = GUICtrlCreateRadio("10", 9, 113, 180, 20) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() For $iX = 1 To 10 If $msg = $aRadio[$iX] Then For $iY = 1 To 10 If $iX <> $iY Then GUICtrlSetState($aRadio[$iY], $GUI_UNCHECKED) Next EndIf Next Select Case $msg = -3 Exit Case $msg = $go For $i = 1 To 60 If GUICtrlRead($aRadio[$i]) = 1 Then MsgBox(0, "", ControlGetText("Title", "", $aRadio[$i])) Next EndSelect WEnd [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 Excellent, thanks for the help, guys. That's exactly what I'm looking for. It works perfectly without slowing anything down. I think the only thing better would be to reset all of the radios when the tab changes, but then I'd have to figure out how to tell when the tab actually changes. The current, and most likely final, code. expandcollapse popupOpt("MustDeclareVars", 1) Global $aRadio[11] = [10] GUICreate("Title", 200, 200) Local $go = GUICtrlCreateButton("Go", 0, 150, 200, 50, 0x0F00) Local $tab = GUICtrlCreateTab(0, 0, 200, 150) GUICtrlCreateTabItem("One") $aRadio[01] = GUICtrlCreateRadio("01", 9, 33, 180, 20) $aRadio[02] = GUICtrlCreateRadio("02", 9, 53, 180, 20) $aRadio[03] = GUICtrlCreateRadio("03", 9, 73, 180, 20) $aRadio[04] = GUICtrlCreateRadio("04", 9, 93, 180, 20) $aRadio[05] = GUICtrlCreateRadio("05", 9, 113, 180, 20) GUICtrlCreateTabItem("Two") $aRadio[06] = GUICtrlCreateRadio("06", 9, 33, 180, 20) $aRadio[07] = GUICtrlCreateRadio("07", 9, 53, 180, 20) $aRadio[08] = GUICtrlCreateRadio("08", 9, 73, 180, 20) $aRadio[09] = GUICtrlCreateRadio("09", 9, 93, 180, 20) $aRadio[10] = GUICtrlCreateRadio("10", 9, 113, 180, 20) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() Select Case $msg = -3 Exit Case $msg = $go Go() EndSelect For $i1 = 1 To 10 If $msg = $aRadio[$i1] Then For $i2 = 1 To 10 If $i1 <> $i2 Then GUICtrlSetState($aRadio[$i2], 4) Next EndIf Next WEnd Func Go() For $i = 1 To 10 If GUICtrlRead($aRadio[$i]) = 1 Then MsgBox(0,"",ControlGetText("Title", "", $aRadio[$i])) Next EndFunc Here's another variation expandcollapse popupOpt("MustDeclareVars", 1) Global $aRadio[11] = [10],$Radio,$Tab2 GUICreate("Title", 200, 200) Local $go = GUICtrlCreateButton("Go", 0, 150, 200, 50, 0x0F00) Local $tab = GUICtrlCreateTab(0, 0, 200, 150) GUICtrlCreateTabItem("One") $aRadio[01] = GUICtrlCreateRadio("01", 9, 33, 180, 20) $aRadio[02] = GUICtrlCreateRadio("02", 9, 53, 180, 20) $aRadio[03] = GUICtrlCreateRadio("03", 9, 73, 180, 20) $aRadio[04] = GUICtrlCreateRadio("04", 9, 93, 180, 20) $aRadio[05] = GUICtrlCreateRadio("05", 9, 113, 180, 20) $Tab2 = GUICtrlCreateTabItem("Two") $aRadio[06] = GUICtrlCreateRadio("06", 9, 33, 180, 20) $aRadio[07] = GUICtrlCreateRadio("07", 9, 53, 180, 20) $aRadio[08] = GUICtrlCreateRadio("08", 9, 73, 180, 20) $aRadio[09] = GUICtrlCreateRadio("09", 9, 93, 180, 20) $aRadio[10] = GUICtrlCreateRadio("10", 9, 113, 180, 20) $Radio = 0 GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() Select Case $msg = -3 Exit Case $msg = $go Go() Case $msg >=$aRadio[1] and $msg <= $aRadio[10] and $msg <> $Tab2 GUICtrlSetState($Radio, 4) GUICtrlSetState($msg, 5);$GUI_CHECKED) $Radio = $msg EndSelect WEnd Func Go() For $i = 1 To 10 If GUICtrlRead($aRadio[$i]) = 1 Then MsgBox(0,"",ControlGetText("Title", "", $aRadio[$i])) Next EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
James Posted June 20, 2009 Share Posted June 20, 2009 Edit: Forgot the code tags ... AGAIN!Damn that old age Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
ProgAndy Posted June 20, 2009 Share Posted June 20, 2009 This is my solution with OnEventMode expandcollapse popup#include<GUIConstantsEx.au3> Opt("MustDeclareVars", 1) Opt("GUIOnEventMode", 1) Global $aRadio[11] = [10] , $giSelectedRadioID = -1 GUICreate("Title", 200, 200) Local $go = GUICtrlCreateButton("Go", 0, 150, 200, 50, 0x0F00) GUICtrlSetOnEvent($go, "GO") Local $tab = GUICtrlCreateTab(0, 0, 200, 150) GUICtrlCreateTabItem("One") $aRadio[01] = GUICtrlCreateRadio("01", 9, 33, 180, 20) $aRadio[02] = GUICtrlCreateRadio("02", 9, 53, 180, 20) $aRadio[03] = GUICtrlCreateRadio("03", 9, 73, 180, 20) $aRadio[04] = GUICtrlCreateRadio("04", 9, 93, 180, 20) $aRadio[05] = GUICtrlCreateRadio("05", 9, 113, 180, 20) GUICtrlCreateTabItem("Two") $aRadio[06] = GUICtrlCreateRadio("06", 9, 33, 180, 20) $aRadio[07] = GUICtrlCreateRadio("07", 9, 53, 180, 20) $aRadio[08] = GUICtrlCreateRadio("08", 9, 73, 180, 20) $aRadio[09] = GUICtrlCreateRadio("09", 9, 93, 180, 20) $aRadio[10] = GUICtrlCreateRadio("10", 9, 113, 180, 20) GUICtrlCreateTabItem("") For $i = 1 To $aRadio[0] GUICtrlSetOnEvent($aRadio[$i], "_RadioAction") Next GUISetOnEvent($GUI_EVENT_CLOSE, "_Close") GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func _Close() Exit EndFunc Func _RadioAction() If $giSelectedRadioID > -1 And $giSelectedRadioID <> @GUI_CtrlId Then GUICtrlSetState($giSelectedRadioID, $GUI_UNCHECKED) $giSelectedRadioID = @GUI_CtrlId EndFunc Func Go() For $i = 1 To $aRadio[0] If $aRadio[$i] = $giSelectedRadioID Then MsgBox(0,"", "RadioIndex: " & $i & @CRLF & "RadioCtrlID: " & $giSelectedRadioID) Next EndFunc *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
martin Posted June 20, 2009 Share Posted June 20, 2009 Well, I think I understand what you were trying to do, but your code doesn't work. Regardless of whether or not it works, that method would really be a pain to add to my full script. Not only "trying" but succeeding for me. But if it's a pain to use for you then that's a different point. If using OnEvent mode as in Prog@ndy's suggestion is also a problem then maybe this version of my suggestion removes some problems for you, but I'm guessing since I don't know what those problems are. expandcollapse popupOpt("MustDeclareVars", 1) Global $aRadio[11] = [10],$Radio,$Gui,$Tab1, $Tab2 $Gui = GUICreate("Title", 200, 200) Local $go = GUICtrlCreateButton("Go", 0, 150, 200, 50, 0x0F00) Local $tab = GUICtrlCreateTab(0, 0, 200, 150) $Tab1 = GUICtrlCreateTabItem("One") $Tab2 = GUICtrlCreateTabItem("Two") GUICtrlCreateTabItem("") GUISwitch($Gui,$tab1) $aRadio[01] = GUICtrlCreateRadio("01", 9, 33, 180, 20) $aRadio[02] = GUICtrlCreateRadio("02", 9, 53, 180, 20) $aRadio[03] = GUICtrlCreateRadio("03", 9, 73, 180, 20) $aRadio[04] = GUICtrlCreateRadio("04", 9, 93, 180, 20) $aRadio[05] = GUICtrlCreateRadio("05", 9, 113, 180, 20) GUISwitch($Gui,$tab2) $aRadio[06] = GUICtrlCreateRadio("06", 9, 33, 180, 20) $aRadio[07] = GUICtrlCreateRadio("07", 9, 53, 180, 20) $aRadio[08] = GUICtrlCreateRadio("08", 9, 73, 180, 20) $aRadio[09] = GUICtrlCreateRadio("09", 9, 93, 180, 20) $aRadio[10] = GUICtrlCreateRadio("10", 9, 113, 180, 20) $Radio = 0 GUISetState(@SW_SHOW) While 1 Local $msg = GUIGetMsg() Select Case $msg = -3 Exit Case $msg = $go Go() Case $msg >=$aRadio[1] and $msg <= $aRadio[10] GUICtrlSetState($Radio, 4) GUICtrlSetState($msg, 5);$GUI_CHECKED) $Radio = $msg EndSelect WEnd Func Go() For $i = 1 To 10 If GUICtrlRead($aRadio[$i]) = 1 Then MsgBox(0,"",ControlGetText("Title", "", $aRadio[$i])) Next EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
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