Champak Posted January 10, 2014 Share Posted January 10, 2014 (edited) How can I prevent focus on a combo box when a specific gui window in my app is activated? Is there something I can put in the creation of the control or GUI? I only want it to have focus when I actually click on it. Edited January 10, 2014 by Champak Link to comment Share on other sites More sharing options...
michaelslamet Posted January 10, 2014 Share Posted January 10, 2014 GUICtrlSetState($hCombo, $GUI_DISABLE) (??) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 10, 2014 Moderators Share Posted January 10, 2014 Champak,Set the focus to another control just before displaying the GUI: #include <GUIConstantsEx.au3> $hGUI = GUICreate("Test", 500, 500) $cCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($cCombo, "1|2|3") $cButton = GUICtrlCreateButton("Focus", 10, 100, 80, 30) ; Give focus to the button GUICtrlSetState($cButton, $GUI_FOCUS) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEndM23 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...
Champak Posted January 10, 2014 Author Share Posted January 10, 2014 I'm unable to test any suggestions right now so I'm just asking questions so I can sort this out when I get home. michaelslamet, if I do that, won't I be unable to use the combo when I actually go to click and use it? Melba23, that's fin on initial creation of the GUI, but when I go to another app or window and then come back won't the combo box have focus upon activation of the window? ---I'm trying to avoid putting any unnecessary/extra things in the main loop, but if that's the route I have to go, I guess I already know what I have to do. Thanks Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 10, 2014 Moderators Share Posted January 10, 2014 Champak,Normally the control that had focus will regain it when the GUI is reactivated - certainly that is the case when I activate/reactivate the GUI created by that script. You could always test for reactivation and reset the focus to whatever you wanted. That would require some code to detect the reactivation which is not that difficult to write. 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...
Champak Posted January 10, 2014 Author Share Posted January 10, 2014 Oh, i didnt know it would default to the original focus if i return to that window. Ok, I'll see when I get home, thanks. 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