Sign in to follow this  
Followers 0
ALTIN

[SOLVED] How to detect Combo value change

9 posts in this topic

#1 ·  Posted (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
EndFunc

I also tried something with _GUICtrlComboBox_GetDroppedState() but could not do it.

Any suggestion please?

Edited by ALTIN

Share this post


Link to post
Share on other sites



add a case where $msg=$hCombo then guictrlread it


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Omg i could feel it was a stupid question but i just got stuck on it...

Cameronsdad thanks, you did it ;)

Share this post


Link to post
Share on other sites

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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

#5 ·  Posted (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 by ALTIN

Share this post


Link to post
Share on other sites

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


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I could not see why you thought cameronsdad's example was not working -

I wonder what I did wrong with his example too... ;)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0