LurchMan Posted September 11, 2014 Share Posted September 11, 2014 Hello Everyone - I have a small application that has a combo box that I would like to have it automatically update the list it contains each time the user clicks on the down arrow. The data comes from a SQLite database. I have attempted to use WM_NOTIFY with the below code: Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") If $iCode = $NM_CLICK Then Switch $hWndFrom Case GUICtrlGetHandle($inPrs_EmpName) ConsoleWrite("you click on Processing Stats Combo" & @CRLF) Case GUICtrlGetHandle($inPS_EmpName) ConsoleWrite("you click on Phone Stats Combo" & @CRLF) Case GUICtrlGetHandle($inPE_EmpName) ConsoleWrite("you click on Phone Eval Combo" & @CRLF) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY I can't seem to get any response out of the combobox. Any Ideas? Thanks for the help in advance. Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
Moderators Solution Melba23 Posted September 11, 2014 Moderators Solution Share Posted September 11, 2014 LurchMan,You need to register WM_COMMAND: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <ComboConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cCombo_1 = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData($cCombo_1, "1|2|3|4") $cCombo_2 = GUICtrlCreateCombo("", 10, 50, 200, 20) GUICtrlSetData($cCombo_2, "A|B|C|D") $cCombo_3 = GUICtrlCreateCombo("", 10, 90, 200, 20) GUICtrlSetData($cCombo_3, "10|20|30|40") GUISetState() GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) If _WinAPI_HiWord($wParam) = $CBN_DROPDOWN Then Switch _WinAPI_LoWord($wParam) Case $cCombo_1 ConsoleWrite("Combo_1 Dropped" & @CRLF) Case $cCombo_2 ConsoleWrite("Combo_2 Dropped" & @CRLF) Case $cCombo_3 ConsoleWrite("Combo_3 Dropped" & @CRLF) EndSwitch EndIf EndFuncThat works for me. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
LurchMan Posted September 11, 2014 Author Share Posted September 11, 2014 Melba23, once again you have made my GUI's much more functional! Thank you for the help! Dating a girl is just like writing software. Everything's going to work just fine in the testing lab (dating), but as soon as you have contract with a customer (marriage), then your program (life) is going to be facing new situations you never expected. You'll be forced to patch the code (admit you're wrong) and then the code (wife) will just end up all bloated and unmaintainable in the end. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 11, 2014 Moderators Share Posted September 11, 2014 LurchMan,Always a pleasure. M23 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 columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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