AlainB Posted October 2, 2011 Posted October 2, 2011 (edited) Is there a way to disable the TabStop for the Radio button on this script? With the "_Winapi....." line it is working but only partially. If I click on one of the radio button, the tabstop start to work again. I cannot use Hotkeyset because I will run multiple instance of the script. Thanks! Alain #include <Constants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Test", 288, 284,-1,-1) $Input1 = GUICtrlCreateInput("", 12, 8, 57, 21) _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP))) $radio1 = GUICtrlCreateRadio("Radio1", 150, 8, 55, 21) GUICtrlSetState($radio1, $GUI_CHECKED) _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP))) $radio2 = GUICtrlCreateRadio("Radio2", 210, 8, 55, 21) _WinAPI_SetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle(-1), $GWL_STYLE), BitNOT($WS_TABSTOP))) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEndtest.au3 Edited October 2, 2011 by AlainB
AlainB Posted October 4, 2011 Author Posted October 4, 2011 Just bumping up my post. The "winAPI...." lines in the script are lines that I took from another thread and they are working fine for inputs. They are not working well for Radio button. Would there be another way to do what I want to do? Many thanks! Alain
Moderators Melba23 Posted October 4, 2011 Moderators Posted October 4, 2011 (edited) AlainB, Interesting behaviour! It seems it is actually Windows doing it each time the Radio control is actioned via the BM_SETCHECK message: "BM_SETCHECK - Sets the check state for all styles of radio buttons and check boxes. If the wParam parameter is greater than zero for radio buttons, the button is given the WS_TABSTOP style." It seems the only solution is to reclear the TABSTOP style each time a Radio is actioned:#include <Constants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Test", 288, 284, -1, -1) $Input1 = GUICtrlCreateInput("", 12, 8, 57, 21) _No_TABSTOP($Input1) $radio1 = GUICtrlCreateRadio("Radio1", 150, 8, 55, 21) GUICtrlSetState($radio1, $GUI_CHECKED) _No_TABSTOP($radio1) $radio2 = GUICtrlCreateRadio("Radio2", 210, 8, 55, 21) _No_TABSTOP($radio2) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $radio1, $radio2 _No_TABSTOP($nMsg) EndSwitch WEnd Func _No_TABSTOP($iCID) _WinAPI_SetWindowLong(GUICtrlGetHandle($iCID), $GWL_STYLE, BitAND(_WinAPI_GetWindowLong(GUICtrlGetHandle($iCID), $GWL_STYLE), BitNOT($WS_TABSTOP))) EndFuncOr you are into subclassing the Radio controls to change the WndProc - that I will leave to someone else! M23 Edit: A bit more reading and I can see this behaviour is actually logical. Normally you have only the one Radio checked at any one time and that is the one to which you would want Windows to move the focus when you press the TAB key. So when setting a Radio to checked Windows will automatically reset the TABSTOP property for that control. At least you only need to clear the property for the checked control (as shown in the code above) and not all of them every time. Edited October 4, 2011 by Melba23 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
AlainB Posted October 5, 2011 Author Posted October 5, 2011 Thank you Melba23, Your solution is working very nicely. Alain
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