Jump to content

Recommended Posts

Posted (edited)

Hi guys, i have a basic gui with combobox:

Global $GUI1 = GUICreate(Title(), 218, 192, -1, -1)
Global $Combo = GUICtrlCreateCombo("", 16, 40, 185, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "Test1|Test2|Test3|Test4|Test5")
Dim $GUI1_AccelTable[1][2] = [["!x", $MenuItem6]]
GUISetAccelerators($GUI1_AccelTable)
GUISetState(@SW_SHOW)

Maybe is a strange question, but if i select "Test1" i want to read another thing, like "001100" with a simply MsgBox

I think is possible with case, i have see this example:

Case "DES"
                    $bAlgorithm = $CALG_DES

                Case "RC2"
                    $bAlgorithm = $CALG_RC2

                Case "RC4"
                    $bAlgorithm = $CALG_RC4

But i don't have idea to use it. Thanks for support

Edited by johnmcloud
  • Moderators
Posted

johnmcloud,

Perhaps like this: :)

#include <GUIConstantsEx.au3>

$hGUI = GUICreate("Test", 500, 500)

$hCombo = GUICtrlCreateCombo("", 10, 10, 200, 20)
GUICtrlSetData(-1, "Test 1|Test 2|Test 3|Test 4|Test 5")

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $hCombo
            Switch GUICtrlRead($hCombo)
                Case "Test 1"
                    MsgBox(0, "Hi", "You selected 'Test 1'")
                Case "Test 2"
                    MsgBox(0, "Hi", "You selected 'Test 2'")
                Case "Test 3"
                    MsgBox(0, "Hi", "You selected 'Test 3'")
                Case "Test 4"
                    MsgBox(0, "Hi", "You selected 'Test 4'")
                Case "Test 5"
                    MsgBox(0, "Hi", "You selected 'Test 5'")
            EndSwitch
    EndSwitch

WEnd

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Posted

No Melba, i need to use it in a function, the msgbox is only an example for see if work

I can't write the number in combo, or noone understand it :)

  • Moderators
Posted

johnmcloud,

You want each selection in the combo to run the same function with a different parameter? :)

Please explain clearly what it is you are trying to do - I can get fed up very quickly with people who keep changing their requirements as the thread progresses. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Posted (edited)

Ok, listen

Test1 --> 0012

Test2 --> 0412

Test3 --> 0712

I can't write this number in combobox or people don't understand, but the function need number ( use external soft )

So if people select Test1, i need to run(test.exe -0012)

Hope is more clear now

Thanks for help

Edited by johnmcloud
  • Moderators
Posted

johnmcloud,

Just replace these lines:

MsgBox(0, "Hi", "You selected 'Test 1'")

with these:

Run("test.exe -0012")

You obviously change the -0012 to match the value that is associated with that item in the combo. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

Posted (edited)

I have try to make somethig like this:

Case "test1"
      Global $out = "0012"
     Case "test2"
      Global $out = "0412"
     Case "test3"
      Global $out = "0712"

Give me error because i don't have declarate a variable.

Is possible to make something like this?

PS You solution work, but i want find a different solution this time. If i can't, i'll use yours Melba

EDIT: This solution work if i'll copy into the same func() of the .exe, thanks for support :)

Edited by johnmcloud
  • Moderators
Posted

johnmcloud,

Either check for the empty combo:

Case ""
    MsgBox(0, "Error", "Please select a value in the combo")

Or set a default value for the combo:

GUICtrlSetData(-1, "Test 1|Test 2|Test 3|Test 4|Test 5", "Test 1")

You choose. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

  • Moderators
Posted

johnmcloud,

i'm try to learn everytime a new thing

Good for you. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

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
×
×
  • Create New...