Jump to content

How to perform call the combo data function when the combo data be selected ?


 Share

Recommended Posts

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()

Local $msg

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

GUICtrlCreateCombo("item1", 10, 10) ; create first item

GUICtrlSetData(-1, "item2|item3", "item3") ; add other item snd set a new default

GUISetState()

; Run the GUI until the dialog is closed

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $label0;x

Exit

Case item2 ;Start

item2();here is i want to do -->once select combo data item2 , then perfrom call item2 function -->Till now have not fixed this issue , i have tried with ID and call function , but still not work , pls give me a hand , thank you .

EndSwitch

WEnd

EndFunc ;==>Example

Func item2()

MsgBox(0,1,1)

EndFunc

Link to comment
Share on other sites

  • Moderators

jinyue115,

I have just posted some code in this thread which shows how to do action combo selections. ;)

M23

P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button.

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

 

Link to comment
Share on other sites

Add a button for select your choice Posted Image

#include <GUIConstantsEx.au3>

Local $nmsg
GUICreate("My GUI combo") ; will create a dialog box that when displayed is centered
$Button1 = GUICtrlCreateButton ( "Apply selection", 8, 56, 100, 25 )
$_Combo = GUICtrlCreateCombo("item1", 10, 10) ; create first item
GUICtrlSetData(-1, "item2|item3", "item3") ; add other item snd set a new default
GUISetState()

; Run the GUI until the dialog is closed
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        ;Case $label0;x
        ;   Exit
        Case $Button1
            $menustate = GUICtrlRead ( $_Combo, 1 )
            If $menustate ='item2' Then 
                ConsoleWrite ( '$menustate : ' & $menustate & @Crlf )
                item2()
            EndIf
    EndSwitch
WEnd


Func item2()
    MsgBox ( 0, 1, $menustate )
EndFunc

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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...