quickbeam Posted December 18, 2018 Posted December 18, 2018 I have some entries supplied in a combo box, but I want people to be able to write in stuff too. If they choose an entry from the pull-down, then GUIGetMsg in my main loop picks up the change, but if an entry is typed in, and they hit tab or enter to move on, the change isn't picked up. I didn't see anything in the $STYLE options to address this, but it's possible I missed something? Or it just can't be done? ; something like this... $ThisTop += 20 GUICtrlCreateLabel("Inputs:", $LabelLeftSide, $ThisTop + 2) $UDKeyNum = GUICtrlCreateCombo("I Don't know", $InputLeftSide, $ThisTop, 60, 20) GUICtrlSetData($UDKeyNum, "Yes|No") While 1 Switch GUIGetMsg() Case $UDKeyNum ConsoleWrite("Key Number entered" & @CRLF) If GUICtrlRead($UDKeyNum) = "Maybe" Then ConsoleWrite("Ding Ding Ding" & @CRLF) EndIf EndSwitch WEnd
FrancescoDiMuro Posted December 18, 2018 Posted December 18, 2018 Hi @quickbeam Usually, you should not allow the user to type in a ComboBox, unless you are sure of what he's going to type in. By the way, GUIGetMsg() won't get the click on the ComboBox; you should use a WM_COMMAND Windows Message handler to "capture" the ComboBox click (or any Notification Code it fires), and do whatever you want. An example of how to use WM_COMMAND with a ComboBox could be find here Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
quickbeam Posted December 18, 2018 Author Posted December 18, 2018 Thanks Francesco. I had searched for an example, as I figured it was there someplace, but I couldn't find it. This does give me a way forward. However: 1) comboboxes by default do allow the user to type in them, hence the name "combo". That can be over-ridden by setting the style to BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST) 2) when the user clicks on a selection already in the list, I do get an event in GUIGetMsg(). Just not when they type in their own thing, for some reason. That's where your WM_COMMAND example will help.
jdelaney Posted December 18, 2018 Posted December 18, 2018 You can store the current text in a variable, and in your primary application loop look if it's changed IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
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