Jump to content

Read Combobox on change


EndFunc
 Share

Recommended Posts

Ok I have a combobox that is populated by values in an Ini file. I have the drop show all the values that I want. What I want to do is when it is changed to another value to do something else.

I know you can probably do Guictrlread but I don't want it constantly reading that ctrl the whole time the app is open. Is there any other way to do this that is efficient?

TIA

To clarify, I don't want a button to excute the option. I want it done when I select the option.

Edited by EndFunc
EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

Ok I have a combobox that is populated by values in an Ini file. I have the drop show all the values that I want. What I want to do is when it is changed to another value to do something else.

I know you can probably do Guictrlread but I don't want it constantly reading that ctrl the whole time the app is open. Is there any other way to do this that is efficient?

TIA

All you need to do is to respond to the event. If you are not using OnEvent mode then in your message loop have something like

$msg = GuiGetMsg()
 Switch $msg
 Case $GUI_EVENT_EXIT
    exit
 Case $Combo1
 ;the selection has been set
 ; do something, but it might not have been changed
EndSwitch

If in OnEvent mode just GuiCtrlRegister($combo1,"combosetfunc")

EDIT:typo

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

All you need to do is to respond to the event. If you are not using OnEvent mode then in your message loop have something like

$msg = GuiGetMsg()
 Switch $msg
 Case $GUI_EVENT_EXIT
    exit
 Case $Combo1
 ;the selection has been set
 ; do something, but it might not have been changed
EndSwitch

If in OnEvent mode just GuiCtrlRegister($combo1,"combosetfunc")

EDIT:typo

Sweet, I learn something everyday. I didn't like the constant polling and didn't realize OnEvent was available. I will look at that. Thanks
EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

All you need to do is to respond to the event. If you are not using OnEvent mode then in your message loop have something like

$msg = GuiGetMsg()
 Switch $msg
 Case $GUI_EVENT_EXIT
    exit
 Case $Combo1
 ;the selection has been set
 ; do something, but it might not have been changed
EndSwitch

If in OnEvent mode just GuiCtrlRegister($combo1,"combosetfunc")

EDIT:typo

I dont see a command GuiCtrlRegister. Were you talking about GUICtrlSetOnEvent?
EndFuncAutoIt is the shiznit. I love it.
Link to comment
Share on other sites

I dont see a command GuiCtrlRegister. Were you talking about GUICtrlSetOnEvent?

Yes, I meant GuiCtrlSetOnEvent. I have a faulty thought to word translator :)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...