Search the Community
Showing results for tags 'GUI_CtrlId'.
-
Hi, I'm totally stumped by this one. I have a general purpose input function that allows a user to select one of a group of radio buttons. As soon as a radio is clicked the gui deletes and returns the text of the choice to the calling function. It works really nicely but i have two functions that call it and the event function for selecting a button never runs, it just gets stuck in the loop waiting for a response. It still works in all other cases (in the same execution of the program). And cutting and pasting (to check for typos etc) the call and the function to a test file (not connected to the rest of the code) it works. Is there anything that can stop an event function being called? the function is: ~ ;takes possible choices separated by | in a string, returns the chosen answer or "input cancelled" if closed Func RadioQBox($title, $prompt, $choices) Local $c = StringSplit($choices, "|");make array into string Local $rads[$c[0] + 1] = [$c[0]];array for control ids Local $ypos = 50, $msg, $sel;set y postion Local $hgt = ($c[0] * 40) + 100;set height GUISetState(@SW_DISABLE, $siteGui);disable main gui Local $radGui = GUICreate($title, 500, $hgt, -1, -1, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_TOPMOST);build form GUICtrlCreateGroup($prompt, 50, 10, 400, $hgt - 10) For $i = 1 To $c[0];create radios $rads[$i] = GUICtrlCreateRadio($c[$i], 60, $ypos, 380, 15) GUICtrlSetOnEvent($rads[$i], "RadioChoice");set on event function $ypos = $ypos + 40 Next GUISetState(@SW_SHOW) Global $RadChoice = 0;selected flag While Not $RadChoice Sleep(200) ;db("rboxloop") WEnd ;db("Radiochoice answer") For $i = 1 To $c[0] If $RadChoice = $rads[$i] Then $sel = $c[$i] $RadChoice = 0 GUIDelete($radGui) If $sel = 'other' Then db("Radiochoice other") $sel = InputBox($title, $prompt & @CRLF & "It is recommended that you make your answer roughly the same length and format as the other options") EndIf EndIf Next GUISetState(@SW_ENABLE, $siteGui) Return $sel EndFunc ;==>RadioQBox The event is Func RadioChoice() $RadChoice = @GUI_CtrlId ;db("radiochoice event", @GUI_CtrlId, @GUI_WinHandle, @GUI_CtrlHandle) EndFunc ;==>RadioChoice Hope you can help