joeyone Posted May 6, 2008 Posted May 6, 2008 I have a script with 2 radio buttons in it, the problem is i cant get my radiobuttons (when i check one of them) to display the messages i want, does someone know whats wrong? heres my code expandcollapse popup#include<GUICONSTANTS.AU3> $box1=GUICreate('',758, 577, 10, 15, $WS_POPUP, bitor($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GUISetBkColor(0x48FF00) Opt("GUIOnEventMode", 1) $mainwindow = GUICreate(" Set bot Position for resolution 1024 x 768", 280, 100, 100, 300, $WS_EX_DLGMODALFRAME) GuiCtrlCreateLabel("", 42, 288, 78, 40) GuiCtrlSetBkColor(-1, 0x00FF00) WinMove($mainwindow, "", 470, 10) $radio1 = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20) $radio2 = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20) GUICtrlSetState ($radio2, $GUI_CHECKED) GUISetState(@SW_SHOW) $aboutbtn = GUICtrlCreateButton("About", 203, 10, 60) $exitbtn = GUICtrlCreateButton("Exit", 203, 40, 60) GUICtrlSetOnEvent($aboutbtn, "aboutbtn") GUICtrlSetOnEvent($exitbtn, "exitbtn") GUISetFont (8) Func aboutbtn() MsgBox(0, "About", "Set game position") EndFunc Func exitbtn() Exit 0 EndFunc GUISetState(@SW_SHOW,$box1) _GUICreateInvRect($box1, 3, 3, 752, 571) While 1 WinMove($box1, "", 127, 146) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.') Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.') EndSelect WEnd Func _GUICreateInvRect($hwnd, $l, $t, $w, $h) $pos = WinGetPos($hwnd) $1 = 0 $2 = 0 $3 = $pos[2] $4 = $t $ret = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = 0 $3 = $l $4 = $pos[3] $ret2 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = $l + $w $2 = 0 $3 = $pos[2] $4 = $pos[3] $ret3 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) $1 = 0 $2 = $t + $h $3 = $pos[2] $4 = $pos[3] $ret4 = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $1, "long", $2, "long", $3, "long", $4) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret2[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret3[0], "int", 2) DllCall("gdi32.dll", "long", "CombineRgn", "long", $ret[0], "long", $ret[0], "long", $ret4[0], "int", 2) DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hwnd, "long", $ret[0], "int", 1) EndFunc Func _end() Exit(0) EndFunc
ProgAndy Posted May 6, 2008 Posted May 6, 2008 You're in OnEventMode! It's killing the Msg-loop. Use this instead: $radio1 = GUICtrlCreateRadio ("Radio 1", 10, 10, 120, 20) GUICtrlSetOnEvent(-1,"RADIOPRESS") $radio2 = GUICtrlCreateRadio ("Radio 2", 10, 40, 120, 20) GUICtrlSetOnEvent(-1,"RADIOPRESS") GUICtrlSetState ($radio2, $GUI_CHECKED) Func RADIOPRESS() Select Case (@GUI_CtrlId= $radio1) And (BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED) MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.') Case @GUI_CtrlId = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.') EndSelect 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
spudw2k Posted May 6, 2008 Posted May 6, 2008 (edited) Was just about to say that. edit: or comment out "Opt("GUIOnEventMode", 1)" if you don't intend on using custom events. Edited May 6, 2008 by spudw2k Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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