$WM_COMMAND and multiple comboboxes
#1
Posted 09 March 2012 - 03:32 PM
$hWndCombo = GUICtrlGetHandle($input[$x][62])
where $input[$x][62] is the handle of the combo.
What I would like is to reuse this code, for multple combo boxes, I can get windows id of the other windows using GUIGetCursorInfo, but not any of the combo boxes, they are always returned as 0.
So How can get the ID of a the Combobox that my cursor is at?
#2
Posted 09 March 2012 - 03:50 PM
_WinAPI_GetFocus returns the control that currently has keyboard input - sounds like just the job.
M23
Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display
RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
#3
Posted 09 March 2012 - 09:32 PM
returns when I'm sitting on the control.
0x0012106E 0x00120ACE 0x00120ACE - which to me means that I ilParam = GUICtrlGetHandle($input[$x][62]) and not _WinAPI_GetFocus().
This isn't helping much. to put things into perpective. $input[$x][62] is the handle of the combo in tab($x) which tab is created only if needed and it's an exact duplicate of the previous Tab. (sort of like do you have more, here is page 2,3,4,5...etc)
I guess when I create the comboboxes, I can create an array which maps the what the GUICtrlGetHandle() of each comboboxes in each tab when I create the tab. And then do an arraysearch or something similar to find which combobox I'm dealing with and use different WM_edit_changed() based upon the index.
So
comboarray[$x][1] = GUICtrlGetHandle($input[$x][60])
comboarray[$x][2] = GUICtrlGetHandle($input[$x][62])
comboarray[$x][3] = GUICtrlGetHandle($input[$x][72]).
Since I know the $X,
for $i=1 to 3
if comboarray[$x][$i] = ilparam then exitloop
next
....
Switch $iCode
Case $CBN_CLOSEUP
Case $CBN_KILLFOCUS
WM_validate()
Case $CBN_EDITCHANGE
switch $i
case 1
WM_edit_changed_combo1()
case 2
WM_edit_changed_combo2()
case 3
WM_edit_changed_combo3()
endswitch
EndSwitch
or something like that.... wish I could find a better way.
#4
Posted 09 March 2012 - 10:00 PM
This code distinguishes between the 2 combos using their ControlIDs - why are you looking for handles?
#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiComboBox.au3> Dim $sString = "Hello|world|AutoIt|rules|and|more|some|data" $hGUI = GUICreate("Test", 500, 500) $cCombo_1 = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData(-1, $sString, "Hello") $cCombo_2 = GUICtrlCreateCombo("", 10, 100, 200, 20) GUICtrlSetData(-1, $sString, "Hello") GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") GUISetState() Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Local $iIDFrom = BitAND($wParam, 0x0000FFFF) Local $iCode = BitShift($wParam, 16) Switch $iCode Case $CBN_EDITCHANGE Switch $iIDFrom Case $cCombo_1 _GUICtrlComboBox_AutoComplete($cCombo_1) Case $cCombo_2 _GUICtrlComboBox_AutoComplete($cCombo_2) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND
If you are still having difficulty identifying your combos, please post some code which shows the problem - then we can get a better idea of what is happening.
M23
Toast - Small GUIs which pop out of the Systray - Marquee - Scrolling tickertape GUIs
Scrollbars - Automatically sized scrollbars with a single command - GUIFrame - Subdivide GUIs into many adjustable frames
GUIExtender - Extend and retract multiple sections within a GUI - NoFocusLines - Remove the dotted focus lines from buttons, sliders, radios and checkboxes
ChooseFileFolder - Single and multiple selections from specified path tree structure - - Notify - Small notifications on the edge of the display
RecFileListToArray - An alternative to _FileListToArray with user-defined include/exclude masks, maximum recursion level, sorting and displayed path options
GUIListViewEx - Insert, delete, move, drag and sort ListView items
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users




