Jump to content

Combo Box Help


Recommended Posts

I'm making a script that when you press a button creates a label on the GUI and I want the text be different depending on what has been selected in a combo box any ideas on how to do this?

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Link to comment
Share on other sites

  • Moderators

Case $Button
  If something Then
    Guictrlcreatelabel()
  ElseIf somethingelse Then
    Guictrlcreatelabel()
   etc...

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered

$cmb_item = GUICtrlCreateCombo("", 10, 10, 90, 120, $CBS_DROPDOWNLIST); create first item
GUICtrlSetData(-1, "item1|item2|item3"); add other item snd set a new default
$label = GUICtrlCreateLabel("", 150, 10, 90, 20, $SS_SUNKEN)
GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $cmb_item
            GUICtrlSetData($label, GUICtrlRead($cmb_item))
    EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Thats not exactly what I needed. I need it to display different text for whatever is selected not what is selected.

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Link to comment
Share on other sites

:)

:mellow: what I mean is: say that frome the combobox I pick "A" now instead of displaying "A" I would want It to display Something like "A. The first letter in the english alphabet"

Is that a better description? :)

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Link to comment
Share on other sites

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

Global $a_values[3] = ["A. The first letter in the english alphabet","B. Whatever you want here","C. Whatever you want here also"]

GUICreate("My GUI combo"); will create a dialog box that when displayed is centered

$cmb_item = GUICtrlCreateCombo("", 10, 10, 90, 120, $CBS_DROPDOWNLIST); create first item
GUICtrlSetData(-1, "A|B|C"); add other item snd set a new default
$label = GUICtrlCreateLabel("", 150, 10, 200, 20, $SS_SUNKEN)
GUISetState()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
            Case $msg = $cmb_item
            GUICtrlSetData($label, $a_values[_GUICtrlComboGetCurSel($cmb_item)])
    EndSelect
WEnd

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...