XGamerGuide Posted November 6, 2022 Share Posted November 6, 2022 (edited) 👋 Hey I want to call a function when something changes on an element in my GUI. That should work for a combo box (with $CBS_DROPDOWNLIST) when I select an item and for a text input when I type. Edited November 6, 2022 by XGamerGuide Link to comment Share on other sites More sharing options...
Nine Posted November 6, 2022 Share Posted November 6, 2022 (edited) WM_COMMAND message is what you are looking at : For combo, it is the CBN_SELCHANGE notification (with CBS_DROPDOWNLIST) For edit (input), it is the EN_UPDATE or EN_CHANGE notification. You simply need to register the message thru GUIRegisterMsg and intercept the modifications. Search forum, as there are tons of examples... Edited November 6, 2022 by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Link to comment Share on other sites More sharing options...
abberration Posted November 6, 2022 Share Posted November 6, 2022 Nine's suggestion of using WM_COMMAND is absolutely the best way of accomplishing your task. However, I know it can be difficult to implement, so I offer an easier, but less effective method. That being said, I think you should use WM_COMMAND instead of my own suggestion. #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 292, 213) $Combo1 = GUICtrlCreateCombo("", 64, 32, 145, 25) GUICtrlSetData(-1, "test|test2|test3") $Label1 = GUICtrlCreateLabel("", 64, 64, 200, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) $Input1 = GUICtrlCreateInput("", 64, 104, 121, 21) $Label2 = GUICtrlCreateLabel("", 64, 136, 200, 33) GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) $Button1 = GUICtrlCreateButton("Exit", 184, 168, 75, 25, $WS_GROUP) $dummy = GUICtrlCreateDummy() GUISetState(@SW_SHOW) Local $aAccelKeys[1][2] = [["{ENTER}", $dummy]] ; when you press ENTER, the combobox & inputbox will update. GUISetAccelerators($aAccelKeys) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Exit Case $Combo1 GUICtrlSetData($Label1, GUICtrlRead($Combo1)) Case $dummy GUICtrlSetData($Label1, GUICtrlRead($Combo1)) GUICtrlSetData($Label2, GUICtrlRead($Input1)) EndSwitch WEnd Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
XGamerGuide Posted November 6, 2022 Author Share Posted November 6, 2022 Thanks. I use WM_COMMAND. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now