Sign in to follow this  
Followers 0
hazed

$WM_COMMAND and multiple comboboxes

4 posts in this topic

I'm trying to use $WM_command to do some creative Auto_complete in a combobox, This works when i Force

$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?

Share this post


Link to post
Share on other sites



hazed,

_WinAPI_GetFocus returns the control that currently has keyboard input - sounds like just the job. :oops:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
Share on other sites

consolewrite(_WinAPI_GetFocus()&@tab& GUICtrlGetHandle($input[$x][62])& @tab&$ilParam&@lf)

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.

Share this post


Link to post
Share on other sites

hazed,

This code distinguishes between the 2 combos using their ControlIDs - why are you looking for handles? :oops:

#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. :bye:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • InunoTaishou
      Mimicking Wordpad using RichEdit
      By InunoTaishou
      As the title implies, trying to mimic Microsoft Word (Older version) using RichEdit. Not an easy task, it's not even 1/10th of what word really is but I wanted to make a small text editor (That supported changing an individual word/letters properties). Some of the functions I wanted to use didn't have a whole lot of information/topics about them so I spent many many hours trying to figure out how to do some things... (Like getting the text from a ExComboBox or changing the color of the rich edit text without changing ALL of the rich edit text (Turns out I just needed to update my AutoIt version....))
      Some of the things I struggled with was reading the Font Size from the ComboBoxEx (GUICtrlRead and ControlGetText do not work, by themselves, but if you use _GUICtrlComboBoxEx_GetEditControl to get the GUICtrlID of the ComboBoxEx you can use ControlGetText), trying to track a Popup menu for the font size (I didn't want to use a dropdown menu, trying to use the scroll wheel to increment/decrement the text in the ComboBoxEx, making sure the correct attribute buttons are Checked depending on the location of the caret (This isn't 100% perfect, I got it to pretty much work though... I originally had it checking the letter 1 left of the caret all the time, except when the caret is at the 0,0 mark, but if the caret is at the very end and the user presses one of the attribute buttons, it won't keep the button checked correctly). There are a few other things but I can't think of them. I don't know enough about the WinAPI in order to make a truly amazing wordpad but maybe this will help some others out there trying to use some of the controls I used.
       
      Also, this was actually made to be attached (_WinAPI_SetParent($frmEditor, WinGetHandle("[Class:LWJGL]")) to a game I play (PokeMMO), so there may be some remnants of the game stuff in here. I don't think so, but there might be... It still functions properly.
      (There is no gameplay automation, it's just supposed to be a child of the game and work as a simple text editor. I've currently submitted it to one of mods of the game so I can release it to the community)
      Beginnings of a Wordpad.rar
    • kneze
      read local Groups of remote Computer add to Combobox
      By kneze
      Hi
      i try to read existing local Groups of remote computer and add to Combobox so i can select a Group to
      get members and add to $ListMembers. Does anyone have a solution how i can read existing local Groups of remote computer and add to Combobox?
       
      thanks.
       
      #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Add / Remove Members", 615, 432, 196, 128) GUISetBkColor(0xFFFFFF) $Group1 = GUICtrlCreateGroup("", 8, 8, 289, 185) GUICtrlSetFont(-1, 10, 800, 0, "Arial") $LabelCpname = GUICtrlCreateLabel("CP Name:", 16, 32, 81, 23) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $InputCpname = GUICtrlCreateInput("", 16, 56, 129, 30) GUICtrlSetFont(-1, 14, 800, 0, "Arial") $LabelLocalGroups = GUICtrlCreateLabel("Local Groups", 16, 96, 107, 20) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $ComboGroups = GUICtrlCreateCombo("", 16, 152, 273, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetFont(-1, 14, 800, 0, "Arial") GUICtrlSetBkColor(-1, 0xFFFF00) $ButtonReadGroups = GUICtrlCreateButton("read local Groups", 160, 56, 130, 25) $ButtonReadmembers = GUICtrlCreateButton("read Members", 16, 120, 130, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("User", 8, 200, 289, 89) GUICtrlSetFont(-1, 10, 800, 0, "Arial") $LabelUserID = GUICtrlCreateLabel("User ID:", 16, 224, 66, 23) GUICtrlSetFont(-1, 12, 800, 0, "Arial") $InputComputer = GUICtrlCreateInput("", 88, 216, 89, 30) GUICtrlSetFont(-1, 14, 800, 0, "Arial") $ButtonAdd = GUICtrlCreateButton("Add User", 184, 216, 100, 25) $ButtonRemove = GUICtrlCreateButton("Remove user", 184, 248, 100, 25) GUICtrlCreateGroup("", -99, -99, 1, 1) $ListMembers = GUICtrlCreateList("", 304, 16, 305, 409) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select ;Case $GUI_EVENT_CLOSE Case $msg = $GUI_EVENT_CLOSE Exitloop Case $msg = $ButtonReadGroups MsgBox(0, "Note", "Button 'read Groups' not work !") Case $msg = $ButtonReadmembers ;MsgBox(0, "Note", "Button 'Read Members' not work !") GUICtrlSetData($ListMembers, "") Local $readCombo = GuiCtrlRead($ComboGroups) GUICtrlSetData($ListMembers, $readCombo) Case $msg = $ButtonAdd MsgBox(0, "Note", "Button 'Add User' not working !") Case $msg = $ButtonRemove MsgBox(0, "Note", "Button 'Remove User' not working !") EndSelect WEnd func terminate() ;exit Exit 0 EndFunc 
    • digitalexpl0it
      Ini to combo box
      By digitalexpl0it
      hello,
      I am having an issue were I am trying to pull everything under a section in a INI file into a combobox.Issue I have is it only selects 2 out of the list. Not sure why
       
      func _ReadHistory() Local Const $sFilePath = "history1.ini" Local $iFileExists = FileExists($sFilePath) ; If the INI file is not found, output error message If not $iFileExists Then msgbox(0,"Oh NO!", $sFilePath & " not found!") endif Local $aArray = IniReadSection($sFilePath, "RemoteHistory") ; Start the array loop and run robocopy If Not @error Then for $i = 0 to $aArray[0][0] _GUICtrlComboBox_InsertString($rdesktopInput, $aArray[$i][1], 0) $i = $i +1 next endif endfuncINI FILE Example [RemoteHistory] HOST=12.12.12.12 HOST=127.0.0.1 HOST=10.10.10.1 HOST=192.168.1.1 HOST=0.0.0.0  
    • Skysnake
      [solved] sqlite rowid to combobox
      By Skysnake
      Hi all
      I am comfortable with SQL and doing okay with Lists, ListViews and Comboboxes.  What I need to do is this: READ row from SQL, place SOME of this row into a combo list, MODIFY data in the Combo, READ the Combo and WRITE back to SQL as an update.
      So, I want to modify existing SQL data in a combo box and then update the SQL to reflect the combo changes.
      My specific problem, is that I do not know how to handle the rowid in the combo environment.  I do not want to show it to the user.
      I have another project where the ID is in fact displayed on screen in the combo, so there it is easy, read the value and run an update.  Now, I need to hide the ID from the user, but not lose it.
      Help? Suggestions? Examples?  I have been searching for some time now, but can't find any related posts.
      Thanks for reading
       
    • Raq
      Got empty value using GUICtrlComboBoxEx_GetItemText
      By Raq
      Hello!
       I would like to ask for your help, regarding getting the value of the combo box in a desktop application.
      I tried the codes below, but I got an empty value. I am really asking for your help if how can I display the value of the combox.
      Func CheckStockCode() $stockWin = Call(OpenClass_32770) Sleep(4000) Local $sText _GUICtrlComboBoxEx_GetItemText(4029, 1, $sText) MsgBox(1, "OUTPUT", $sText) EndFunc ;==>CheckStockCode Thanks in advance,
      Raq