ALTIN Posted September 20, 2010 Share Posted September 20, 2010 (edited) I think my problem is simple but Im not finding how to solve it.I have a Combo and I want to get its current value upon when I select it (upon it changes when selected), I mean without adding any button or other control to do a GUICtrlRead($hCombo)This is what I basically have:#include <GUIConstantsEx.au3> Example() Func Example() Local $msg GUICreate("My GUI combo", 300, 150) $hCombo = GUICtrlCreateCombo("item1", 10, 10) GUICtrlSetData(-1, "item2|item3", "item3") GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop ToolTip(GUICtrlRead($hCombo)) WEnd EndFuncI also tried something with _GUICtrlComboBox_GetDroppedState() but could not do it.Any suggestion please? Edited September 20, 2010 by ALTIN Link to comment Share on other sites More sharing options...
seandisanti Posted September 20, 2010 Share Posted September 20, 2010 add a case where $msg=$hCombo then guictrlread it Link to comment Share on other sites More sharing options...
ALTIN Posted September 20, 2010 Author Share Posted September 20, 2010 Omg i could feel it was a stupid question but i just got stuck on it... Cameronsdad thanks, you did it Link to comment Share on other sites More sharing options...
seandisanti Posted September 20, 2010 Share Posted September 20, 2010 Omg i could feel it was a stupid question but i just got stuck on it...Cameronsdad thanks, you did it no worries man, the easiest to find are also the easiest to overlook Link to comment Share on other sites More sharing options...
ALTIN Posted September 20, 2010 Author Share Posted September 20, 2010 (edited) Oh yet..... sorry again I want to get the current value after I select it on combo when it is not dropped down but this seems to return the value even if combo is dropped down and i hover the mouse over it...So I guess it does basically the same thing I had before...P.S.: Sorry, I read the previous post from mobile and thought it was solved but now that I try in editor, I see it did not...Any other idea? Edited September 20, 2010 by ALTIN Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 20, 2010 Moderators Share Posted September 20, 2010 ALTIN, I think does what you want - it waits until you have closed the combo before reading the value: #include <GUIConstantsEx.au3> #include <GuiComboBox.au3> $hGUI = GUICreate("Test", 500, 500) $hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($hCombo, "|1|2|3|4") GUISetState() $sCurrCombo = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $sComboSel = GUICtrlRead($hCombo) If $sComboSel <> $sCurrCombo And _GUICtrlComboBox_GetDroppedState($hCombo) = False Then MsgBox(0, "Selection", $sComboSel) $sCurrCombo = $sComboSel EndIf WEnd M23 pixelsearch 1 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...
ALTIN Posted September 20, 2010 Author Share Posted September 20, 2010 I think does what you want - it waits until you have closed the combo before reading the value: Oh I see now you both are just right and I know I may look weird and stupid today I made such a big alarm for a beginner problem.Anyway Thankx Cameronsdad, Thanks Melba23, you both solved it. I guess I need a long break to stop hanging in simple things Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 20, 2010 Moderators Share Posted September 20, 2010 ALTIN, I could not see why you thought cameronsdad's example was not working - so I decided I would show you another way - although his version is simpler! 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...
ALTIN Posted September 20, 2010 Author Share Posted September 20, 2010 I could not see why you thought cameronsdad's example was not working - I wonder what I did wrong with his example too... 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