Sign in to follow this  
Followers 0
BigDaddyO

GuiCtrlCreateCombo Get Highlighted item

5 posts in this topic

Hello all,

In an attempt to minimize or eliminate help documents for my new program, I am trying to create as many tool tips and on screen information as possible for my end users. "I hate making How-To Doc's"

I have a ComboBox in my gui that has 6 possible selections.

When a user clicks the drop down, I would like to be able to identify which item is highlighted and then display a ToolTip giving them more information about that highlighted item.

Anybody have some ideas on how to identify the highlighted item?

Thanks,

Mike


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

hi,

#include <GUIConstants.au3>
#Include <GuiCombo.au3>

Global $Tip = StringSplit(" is best for most users| is usaually better for other users|" & _
                            " is not very useful| is seldom needed| should be used with caution|" & _
                            " should only be used on sundays", "|")
Global $Last                            

GUICreate("Combo Tips", 170,40)
$Combo = GUICtrlCreateCombo("", 10, 10, 150, 20, $CBS_DROPDOWNLIST)
GUICtrlSetData(-1, "Option 1|Option 2|Option 3|Option 4|Option 5|Option 6")
GUICtrlSetTip(-1, "Select option")
GUISetState()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
    If GUICtrlRead($Combo) <> $Last Then
        For $i = 1 To 6
            If GUICtrlRead($Combo) = "Option " & $i Then
                ToolTip(GUICtrlRead($Combo) & $Tip[$i])
                $Last = GUICtrlRead($Combo)
            EndIf
        Next
    EndIf
    If Not _GUICtrlComboGetDroppedState($Combo) Then
        ToolTip("")
    EndIf   
WEnd

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites

If GUICtrlRead($Combo) = "Option " & $i Then

Cheers

Doh, I never realized I could use GUICtrlRead like that.

That's exactly what I needed.

Thanks,

Mike


Share this post


Link to post
Share on other sites

Hello all,

In an attempt to minimize or eliminate help documents for my new program, I am trying to create as many tool tips and on screen information as possible for my end users. "I hate making How-To Doc's"

I have a ComboBox in my gui that has 6 possible selections.

When a user clicks the drop down, I would like to be able to identify which item is highlighted and then display a ToolTip giving them more information about that highlighted item.

Anybody have some ideas on how to identify the highlighted item?

Thanks,

Mike

You may want to consider adding an option to enable your users to turn off the tool tips once they are familiar with your application. I added tool tips for everything to an application I produced a few months ago. Initially users liked the help but soon grew to hate it, a bit like most peoples reactions to the Microsoft paper clip. I quickly had to update it with and option to turn tool tips off.

User feed has taught me quite a lot. The main thing being the users of software I write never use it in the way I thought they would. <_<

Bowmore


"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Share this post


Link to post
Share on other sites

You may want to consider adding an option to enable your users to turn off the tool tips once they are familiar with your application. I added tool tips for everything to an application I produced a few months ago. Initially users liked the help but soon grew to hate it, a bit like most peoples reactions to the Microsoft paper clip. I quickly had to update it with and option to turn tool tips off.

User feed has taught me quite a lot. The main thing being the users of software I write never use it in the way I thought they would. <_<

Bowmore

Very good point.

To reduce what little overhead this requires, I set it to launch on mouse down so it wouldn't constantly check for the Combobox state.

Mike


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