# How to get notified when user clicks combo boxe's edit area ?

## Recommended Posts

Hi all,

How can i get notified when user clicks on a combo box's edit area ? This is my code so far.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <ComboConstants.au3>
#include <ListBoxConstants.au3>

Global $btn ; creates a window Global$Window_0 = GUICreate("My Window", 800, 500, -1, -1, BitOR($WS_SIZEBOX,$WS_MINIMIZEBOX, $WS_MAXIMIZEBOX))$btn = GUICtrlCreateButton("Click Me", 50, 50, 120, 50)
Global $cmb = GUICtrlCreateCombo("Sample", 50, 150, 300, 50) GUICtrlSetFont(-1,12,400) Global$lstbx = GUICtrlCreateList("FirstItem", 400,50, 200, 300)
GUICtrlSetFont(-1,12,400)

GUIRegisterMsg($WM_COMMAND, "MyEventCallback") GUIRegisterMsg($WM_SIZE, "MyEventCallback")
GUIRegisterMsg($WM_NOTIFY, "NotifyManager") GUISetState(@SW_SHOW) GUICtrlSetData($cmb, "Item 2|Item 3", "Item 2")
GUICtrlSetData($lstbx, "Apple|Orange|Pineapple|Grape|Lemon") Do$Event = GUIGetMsg( )

Until $Event =$GUI_EVENT_CLOSE

Func MyEventCallback($hwnd,$message, $wParam,$lParam)
Select

Case $message =$WM_COMMAND
;----------------------------------------------------------------
If LoWord($wParam) =$cmb Then ; if control id is combox's Then
Local $Notification = HiWord($wParam)
Select
Case $Notification =$CBN_DROPDOWN   ; here we check the notification code.
ConsoleWrite("$CBN_DROPDOWN Worked " & @MIN & ":" & @SEC & @CRLF) Case$Notification = $CBN_EDITCHANGE ; here we check the notification code. ConsoleWrite("$CBN_EDITCHANGE Worked " & @MIN & ":" & @SEC & @CRLF)

; **** Here i want add the code for combo box clicking.

EndSelect
;---------------------------------------------------------------------
ElseIf LoWord($wParam) =$lstbx Then
Local $Notification = HiWord($wParam)
Select
Case $Notification =$LBN_SELCHANGE
ConsoleWrite("$LBN_SELCHANGE" & @CRLF) EndSelect EndIf ;------------------------------------------------------------------ Case$message = $WM_SIZE EndSelect Return$GUI_RUNDEFMSG
EndFunc   ;==>ProGUI_EventCallback

Func NotifyManager($hWnd,$iMsg, $wParam,$lParam)
#forceref $hWnd,$iMsg, $wParam ;Local$hWndFrom, $iIDFrom,$iCode, $tNMHDR Local$tagNMHDR, $event,$hwndFrom, $code$tagNMHDR = DllStructCreate("int;int;int", $lParam) If DllStructGetData($tagNMHDR, 3) = $NM_LDOWN Then ConsoleWrite("Notify Worked" & @CRLF) EndIf Return$GUI_RUNDEFMSG
EndFunc

Func LoWord($Variable) Return BitAND($Variable, 0xFFFF)
EndFunc

Func HiWord($Variable) Return BitShift($Variable, 16)
EndFunc

My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs

Includer_2  ----- A tool to type the #include statement automatically

Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

Alert  ------ An alternative for MsgBox

MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

##### Share on other sites

My resources are limited. You must ask the right questions

##### Share on other sites

Get a handle to the edit control and subclass the edit control:

#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPIShellEx.au3>

Global $g_idMemo Example() Func Example() Local$tInfo, $idCombo ; Create GUI GUICreate("ComboBox Get ComboBox Info", 400, 296)$idCombo = GUICtrlCreateCombo("", 2, 2, 396, 296)
$g_idMemo = GUICtrlCreateEdit("", 2, 32, 396, 266, 0) GUICtrlSetFont($g_idMemo, 9, 400, 0, "Courier New")
GUISetState(@SW_SHOW)

_GUICtrlComboBox_BeginUpdate($idCombo) _GUICtrlComboBox_AddDir($idCombo, @WindowsDir & "\*.exe")
_GUICtrlComboBox_EndUpdate($idCombo) If _GUICtrlComboBox_GetComboBoxInfo($idCombo, $tInfo) Then MemoWrite("Handle to the ComboBox .....: " & DllStructGetData($tInfo, "hCombo"))
MemoWrite("Handle to the Edit Box .....: " & DllStructGetData($tInfo, "hEdit")) MemoWrite("Handle to the drop-down list: " & DllStructGetData($tInfo, "hList"))
EndIf

Local $hEdit = DllStructGetData($tInfo, "hEdit")
Local $pMsgHandler = DllCallbackGetPtr( DllCallbackRegister( "MsgHandler", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) ) _WinAPI_SetWindowSubclass($hEdit, $pMsgHandler, 1000, 0 ) ;$iSubclassId = 1000, $pData = 0 ; Loop until the user exits. Do Until GUIGetMsg() =$GUI_EVENT_CLOSE

; Cleanup
_WinAPI_RemoveWindowSubclass( $hEdit,$pMsgHandler, 1000 ) ; Unregister message handler
GUIDelete()
EndFunc   ;==>Example

; Write a line to the memo control
Func MemoWrite($sMessage) GUICtrlSetData($g_idMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; Message handler based on subclassing Func MsgHandler($hWnd, $iMsg,$wParam, $lParam,$iSubclassId, $pData ) Switch$iMsg
Case $WM_LBUTTONDOWN ConsoleWrite( "$WM_LBUTTONDOWN" & @CRLF )
EndSwitch

; Call next function in subclass chain (this forwards WM_COMMAND messages to main GUI (other messages are already forwarded))
Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint",$iMsg, "wparam", $wParam, "lparam",$lParam )[0]
EndFunc

##### Share on other sites

@Earthshine Thank you. Will check it.

@LarsJ Thank you for the reply. Before reading your code, let me ask you a question. In vb.net we have an event named "ComboBox_Mouseclick"  So I assumed that there is a notification message is coming from combo box to parent window if we click the combo. If there is no such messages are coming, then vb.net's mouse click event is using a subclassing techiniq like you did in your reply ?

Edit note :- Without subclassing, is it impossible ?

Edited by kcvinu

My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs

Includer_2  ----- A tool to type the #include statement automatically

Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

Alert  ------ An alternative for MsgBox

MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

##### Share on other sites

I don't know much about VB.NET, but I don't think standard controls and VB.NET controls are comparable with regard to code. And event messages and notifications are also not comparable.

I think "ComboBox_Mouseclick" is a standard message. It's not implemented through subclassing.

In AutoIt it's impossible without subclassing, because the internal message handler would "eat" all the mouse clicks.

##### Share on other sites

@LarsJ Thanks for the reply. Well, i was playing with some AutoIt code to use all events in AuotIt like we did in any dot net language.  I can use most common notification messages with GuiRegisterMsg.  But this one was very hard. I am glad to know that it is possible with atleast subclassing. I wish if AutoIt's internal msg handler doesn't swallow these notifications.

Edit Note - By the way, i can't find $tagCOMBOBOXINFO structure in AutoIt help file. But i found one in MSDN. I think although, AutoIt is not allowing us to code in the straight forward method, it will allow us to do these kind of tasks in complex ways. Edited by kcvinu My Contributions UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only) #### Share this post ##### Link to post ##### Share on other sites kcvinu, Less elegant but seemingly effective: #include <GUIConstantsEx.au3> #include <GuiComboBox.au3> #include <WinAPI.au3> Global$tInfo, $bFocus = False Global$Window_0 = GUICreate("My Window", 800, 500)

$btn = GUICtrlCreateButton("Click Me", 50, 50, 120, 50) Global$cmb = GUICtrlCreateCombo("Sample", 50, 150, 300, 50)

Global $lstbx = GUICtrlCreateList("FirstItem", 400,50, 200, 300) GUICtrlSetData($cmb, "Item 2|Item 3", "Item 2")
GUICtrlSetData($lstbx, "Apple|Orange|Pineapple|Grape|Lemon") GUISetState(@SW_SHOW) _GUICtrlComboBox_GetComboBoxInfo($cmb, $tInfo)$hComboEdit = DllStructGetData($tInfo, "hEdit") While 1 Switch GUIGetMsg() Case$GUI_EVENT_CLOSE
Exit
EndSwitch

If _WinAPI_GetFocus() = DllStructGetData($tInfo, "hEdit") And$bFocus = False Then
$bFocus = True ConsoleWrite("True" & @CRLF) ElseIf _WinAPI_GetFocus() <> DllStructGetData($tInfo, "hEdit") And $bFocus = True Then$bFocus = False
ConsoleWrite("False" & @CRLF)
EndIf

WEnd

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 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 on other sites

@Melba23 Wow ! Thank you for the code. This is amazing. I thought this is impossible without complex stuff like subclassing. But you just proved that it is possible with some api funcs. Although, it won't fire consoleWrite when we clicked second time, because the focus is still on combo's edit control, it is an evidence of the power of win32 api . Anyhow, this aproach is great.

My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs

Includer_2  ----- A tool to type the #include statement automatically

Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

Alert  ------ An alternative for MsgBox

MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

##### Share on other sites

Hello. Another way...

#include <GUIConstantsEx.au3>
#include <GuiComboBox.au3>
#include <WinAPI.au3>

Global $tInfo Global$Window_0 = GUICreate("My Window", 800, 500)

$btn = GUICtrlCreateButton("Click Me", 50, 50, 120, 50) Global$cmb = GUICtrlCreateCombo("Sample", 50, 150, 300, 50)
Global $lstbx = GUICtrlCreateList("FirstItem", 400, 50, 200, 300) GUICtrlSetData($cmb, "Item 2|Item 3", "Item 2")
GUICtrlSetData($lstbx, "Apple|Orange|Pineapple|Grape|Lemon") GUISetState(@SW_SHOW) _GUICtrlComboBox_GetComboBoxInfo($cmb, $tInfo) Global$hComboEdit = DllStructGetData($tInfo, "hEdit") While 1 Switch GUIGetMsg() Case$GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_PRIMARYDOWN _CheckComBoxClickTextArea() EndSwitch WEnd Func _CheckComBoxClickTextArea() Local$g_tStruct = DllStructCreate($tagPOINT) DllStructSetData($g_tStruct, "x", MouseGetPos(0))
DllStructSetData($g_tStruct, "y", MouseGetPos(1)) Local$hHandleFromPoint=_WinAPI_WindowFromPoint($g_tStruct) If$hHandleFromPoint = $hComboEdit Then ConsoleWrite("Clicked" & @CRLF) EndIf EndFunc Saludos Edited by Danyfirex AutoIt... #### Share this post ##### Link to post ##### Share on other sites kcvinu, Quote it won't fire consoleWrite when we clicked second time Then try this: #include <GUIConstantsEx.au3> #include <GuiComboBox.au3> #include <WinAPI.au3> Global$tInfo

Global $Window_0 = GUICreate("My Window", 800, 500)$btn = GUICtrlCreateButton("Click Me", 50, 50, 120, 50)
Global $cmb = GUICtrlCreateCombo("Sample", 50, 150, 300, 50) Global$lstbx = GUICtrlCreateList("FirstItem", 400,50, 200, 300)

GUICtrlSetData($cmb, "Item 2|Item 3", "Item 2") GUICtrlSetData($lstbx,  "Apple|Orange|Pineapple|Grape|Lemon")

GUISetState(@SW_SHOW)

_GUICtrlComboBox_GetComboBoxInfo($cmb,$tInfo)
$hComboEdit = DllStructGetData($tInfo, "hEdit")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE Exit Case$GUI_EVENT_PRIMARYDOWN
If _WinAPI_GetFocus() = DllStructGetData($tInfo, "hEdit") Then ConsoleWrite("Hit" & @CRLF) EndIf EndSwitch WEnd 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 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 M32 when you open and close the drop down the event is raised too Also when you select alList Item. Saludos AutoIt... #### Share this post ##### Link to post ##### Share on other sites Danyfirex, I see - it is because those actions give focus to the edit. time for another think..... 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 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 Et voila! #include <GUIConstantsEx.au3> #include <GuiComboBox.au3> #include <WinAPI.au3> Global$tInfo

Global $Window_0 = GUICreate("My Window", 800, 500)$btn = GUICtrlCreateButton("Click Me", 50, 50, 120, 50)
Global $cmb = GUICtrlCreateCombo("Sample", 50, 150, 300, 50) Global$lstbx = GUICtrlCreateList("FirstItem", 400,50, 200, 300)

GUICtrlSetData($cmb, "Item 2|Item 3", "Item 2") GUICtrlSetData($lstbx,  "Apple|Orange|Pineapple|Grape|Lemon")

GUISetState(@SW_SHOW)

_GUICtrlComboBox_GetComboBoxInfo($cmb,$tInfo)
$hComboEdit = DllStructGetData($tInfo, "hEdit")

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE Exit Case$GUI_EVENT_PRIMARYDOWN
If _WinAPI_GetFocus() = DllStructGetData($tInfo, "hEdit") And _GUICtrlComboBox_GetDroppedState($cmb) = False Then
ConsoleWrite("Hit" & @CRLF)
EndIf
EndSwitch
WEnd

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 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 on other sites

It still happen when drop close.

Saludos

AutoIt...

##### Share on other sites

Danyfirex,

Annoyingly correct! Back to thinking mode.....

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 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 on other sites

Another way.

#include <GUIConstantsEx.au3>
#include <GuiComboBox.au3>
#include <WinAPI.au3>
#include <Array.au3>
#include <WinAPIGdi.au3>
Global $tInfo Global$Window_0 = GUICreate("My Window", 800, 500)

$btn = GUICtrlCreateButton("Click Me", 50, 50, 120, 50) Global$cmb = GUICtrlCreateCombo("Sample", 50, 150, 300, 50)

Global $lstbx = GUICtrlCreateList("FirstItem", 400, 50, 200, 300) GUICtrlSetData($cmb, "Item 2|Item 3", "Item 2")
GUICtrlSetData($lstbx, "Apple|Orange|Pineapple|Grape|Lemon") GUISetState(@SW_SHOW) _GUICtrlComboBox_GetComboBoxInfo($cmb, $tInfo) Global$hComboEdit = DllStructGetData($tInfo, "hEdit") While 1 Switch GUIGetMsg() Case$GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_PRIMARYDOWN _CheckComBoxClickTextArea() EndSwitch WEnd Func _CheckComBoxClickTextArea() Local$iX = MouseGetPos(0)
Local $iY = MouseGetPos(1) Local$tRect = _WinAPI_GetWindowRect($hComboEdit) Local$iLeft = DllStructGetData($tRect, 1) Local$iTop = DllStructGetData($tRect, 2) Local$iRight = DllStructGetData($tRect, 3) Local$iBottom = DllStructGetData($tRect, 4) If _WinAPI_PtInRectEx($iX, $iY,$iLeft, $iTop,$iRight, $iBottom) Then ConsoleWrite("Clicked" & @CRLF) EndIf EndFunc ;==>_CheckComBoxClickTextArea Saludos AutoIt... #### Share this post ##### Link to post ##### Share on other sites This is can be another way #include <GUIConstantsEx.au3> #include <WindowsConstants.au3>$Window_0 = GUICreate("My Window", 800, 500, -1, -1, BitOR($WS_SIZEBOX,$WS_MINIMIZEBOX, $WS_MAXIMIZEBOX))$btn = GUICtrlCreateButton("Click Me", 50, 50, 120, 50)

$cmb1 = GUICtrlCreateCombo("Sample1", 50, 150, 300, 50)$cmb2 = GUICtrlCreateCombo("Sample2", 50, 200, 300, 50)

GUISetState(@SW_SHOW)

Do
$event = GUIGetMsg() Switch$event
Case $GUI_EVENT_PRIMARYDOWN If MouseGetCursor() = 5 Then ConsoleWrite(ControlGetFocus($Window_0) & @CRLF)
EndSwitch
Sleep(50)
Until $event =$GUI_EVENT_CLOSE

Edited by Deye

##### Share on other sites

@Melba23, @Danyfirex, @Deye Thanks to all. Each of your code is great and amazing. So, what i learn from this post is --

If you want to provide mouse click event for your controls like combo, list box etc..

You should...

1. Get the handle of that particular control.

2. Trap the primary down event

3. Check the mouse position. If that is your control's position, call your event handler.

And Deye's technique is little bit different. He checked for mouse cursor. (Brilliant !  )

Well, i am in search of how to implement all type of event handling in AutoIt. Thanks for all your inputs. They helped me a lot to learn.

Edited by kcvinu

My Contributions

UDF Link Viewer   --- A tool to visit the links of some most important UDFs

Includer_2  ----- A tool to type the #include statement automatically

Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

Alert  ------ An alternative for MsgBox

MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

## Create an account

Register a new account

• ### Similar Content

• By DannyJ
Hello Forum,
I have one special Combo-box [with BitOR($CBS_DROPDOWNLIST,$GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE) ] and if I press one button I want to change the Combo-box's background color, and after I press Button B I want to change it to the basic settings and it not works. I wanna do this with one combo-box. I have already tried several methods and I tried GUICtrlComboSetColors that I have found on this forum. (But this methods works perfectly with Cobo boxes that don't have BitOR($CBS_DROPDOWNLIST, $GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE).
Here is the example code
#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= ;$CBS_DROPDOWNLIST ;$GUI_SS_DEFAULT_COMBO $Form1 = GUICreate("Form1", 504, 249, 252, 227)$Combo1 = GUICtrlCreateCombo("", 136, 24, 193, 25,BitOR($CBS_DROPDOWNLIST,$GUI_SS_DEFAULT_COMBO, $CBS_SIMPLE)) ; I want to change this special combo's background color if I press button 1$Button1 = GUICtrlCreateButton("Button1", 112, 96, 75, 25) $Button2 = GUICtrlCreateButton("Button2", 264, 96, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### GUICtrlSetData($Combo1," " & "|" & "apple" & "|" & "banana" & "|" & "cherry" ," ") While 1 $nMsg = GUIGetMsg() Switch$nMsg Case $GUI_EVENT_CLOSE Exit Case$Button1 GUICtrlSetBkColor($Combo1,0x0078D7) Case$Button2 ;Makes the original bc color GUICtrlSetBkColor($Combo1,0xFFFFFF) EndSwitch WEnd Thanks you in advance your help • Hi All, I am trying to login into our application using AutoIT. When I launch the application a splash screen appears and the login screen goes behind it. At this point the script pauses and I loose control of everything. I have literally tried everything for the past two days but nothing has worked yet. Any suggestions would be appreciated. RunWait("\\mchsv411.siplaceworld.net\splmshare\int00\conf\start_apps\windows\start_nx110.bat en portal_client int00 tc112", "", @SW_MAXIMIZE) AutoItSetOption("SendKeyDelay", 200) Local$hWnd = WinWaitActive("Teamcenter Login")
MouseClick("left", @DesktopWidth / 2, @DesktopHeight / 2)
The splash screen has title "Teamcenter" and is static.
I tried to click on the center to get control of login window.
I have tried WinActivate, WinSetState, ControlCommand and a lot of other things.
• By lonardd
Hi,
I have a very strange problem concerning MouseClick function.
I need to start Control Panel, navigate it on the Display Section (Adjust screen resolution link), click on it, and from the next Dialog choose Intel Graphic tool tab and navigate into it when it opens.
I wasn't using MouseClick() at first when I tried to use Control IDs, but I was fed up with the Autoit Window Info poor and inaccurate info (It flickers and the moment I click on the control the control ID and class disappear) so I ended up choosing the easiest way.
The code I'm posting worked OK until two weeks ago, the mouse clicks were accurately performed and the Script reached the end with no errors...and I was happy.
All of a sudden, between one try and the other, I noticed the cursor not flying exactly where it was supposed to, namely to the Control Panel ->Display->Adjust screen resolution link   but it clicked some 30 pixels below and some 30 pixels to the left, choosing obviously and undesired function and from that point it screwed the whole thing up. And from that moment onward, it seems I can no longer regain the mouse to click on that sequence.
Could it be because my Control Panel ->Display form moved slightly from one test to another and therefore I got that small offside?
If you believe this is the reason, I should then re position the Control Panel ->Display window to 0,0 and recalculate all the clicks.
do you have a suggestion?

Thanks a lot
Dave

RotateDisplays.au3
• By Reher
Hi
so i ran into a Problem i didn't expect to get stuck on.
It sounds simple (and probably is) but i can't seem to get it to work
So i created a Combobox and filled it with some things from an array which worked fine.
$combobox = GUICtrlCreateCombo($list[0], 160, 200, 265, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GuiCtrlSetData($list, "|" & _ArrayToString($list,Default,1),$list[2]) GUICtrlSetFont(-1, 9, 400, 0, "Arial") Now i want to change the style of the combobox from$CBS_DROPDOWN to $CBS_DROPDOWNLIST via a checkbox.$Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 160, 96, 105, 25) Case $Checkbox1 If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then Call ("Read_only") Else Call ("Edit") Endif Func Read_only() GUICtrlSetStyle ($Combobox1,something to change it to $CBS_DROPDOWNLIST) EndFunc Func Edit() GUICtrlSetStyle ($Combobox1,something to change it to $CBS_DROPDOW) EndFunc I tried using$CBS_DROPDOWN and $CBS_DROPDOWNLIST but it simply does nothing. I also tried$ES_READONLY which kinda worked, it changed the combobox so i couldn't change the input via dropdown anymore but i could still type in it via keyboard (which i dont want).
It's essential that its Editable but once the checkbox is checked the combobox becomes readonly so you can't type in it anymore but you can still choose between the items in the list. (It does not have to save your current input if you write something in it and then check the Checkbox it would be best if it would simpy jump back to the first item in the list)
Im sure this is a simple thing but after long google search im tired of my stupidity can someone give me a push in the right direction?
• By c1one
Something simple enough, and I am sure it's an oversight, but I have not been able to track this down. The entire script is attached, but here is the point of failure.
Note: I am getting the "Error: subscript used on non-accessible variable" but I thought the initial line of:
AutoItSetOption('MouseCoordMode', 0)
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
; Install updates (minimized and updating for many minutes)
; Wait for updates to complete
WinWait("ProSeries Update")
; Wait just over 9 minutes to ensure popup is ready (test alternative to WinWait)
Sleep(550000)
; Set focus on Product Licenses window
WinActivate("ProSeries Update")
; Send Mouse Click to Install Now button
MouseClick ( "left" [, 581, 362 [, clicks = 1 [, speed = 10]]] )
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Thanks for any insights!
c1one
ProSeries2017_No_Customer_Info.au3
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...