Sign in to follow this  
Followers 0
JoGa

_GUICtrlComboBoxEx event handling

5 posts in this topic

Hi folks ,

in the below code the combobox event does not work, any hints?

Thanks for reading.

CODE
#include <GuiComboBoxEx.au3>

#include <GuiImageList.au3>

#include <GuiConstantsEx.au3>

### Create GUI

$GUI = GUICreate("ComboBoxEx", 200, 100)

### Combo

$ImageCombo = _GUICtrlComboBoxEx_Create($GUI, "", 2, 2, 150, 120)

$ImageList = _GUIImageList_Create(80, 15, 3)

GUISetState()

### create image list

_GUIImageList_AddBitmap($ImageList, "PnP#001.bmp")

_GUIImageList_AddBitmap($ImageList, "PnP#002.bmp")

### Set Image List

_GUICtrlComboBoxEx_SetImageList($ImageCombo, $ImageList)

For $x = 0 To 1

_GUICtrlComboBoxEx_AddString($ImageCombo, "t-" & $x, $x, $x)

Next

while(true)

$msg = GUIGetMsg()

Switch $msg

Case $GUI_EVENT_CLOSE

Exit

Case $ImageCombo

MsgBox(0, "ComboTest", "ImageCombo: " & $msg)

Default

MsgBox(0, "ComboTest", "Default: " & $msg)

EndSwitch

wend

########################################################################

Share this post


Link to post
Share on other sites



Hope this Helps.

#include<GuiComboBoxEx.au3>
#include<GuiImageList.au3>
#include<GUIConstantsEx.au3>
#include<ComboConstants.au3>
#include<WindowsConstants.au3>

;### Create GUI
$GUI = GUICreate("ComboBoxEx", 200, 100)

;### Combo
$ImageCombo = _GUICtrlComboBoxEx_Create($GUI, "", 2, 2, 150, 120)
$ImageList = _GUIImageList_Create(80, 15, 3) 

GUISetState()

;### create image list
$hImage = _GUIImageList_Create(16, 16, 5, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 13, FALSE)
_GUIImageList_AddIcon($hImage, @SystemDir & "\shell32.dll", 12, False)
;### Set Image List
_GUICtrlComboBoxEx_SetImageList($ImageCombo, $hImage)

For $x = 0 To 1
_GUICtrlComboBoxEx_AddString($ImageCombo, "t-" & $x, $x, $x)
Next
_GUICtrlComboBoxEx_SetCurSel($ImageCombo,0)


 GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")


while 1
sleep(50)
wend

Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg
    Local $hWndFrom, $iIDFrom, $iCode
    $hWndFrom = $ilParam
    $iIDFrom = BitAND($iwParam, 0xFFFF) ; Low Word
    $iCode = BitShift($iwParam, 16) ; Hi Word
    Switch $hWndFrom
        Case $ImageCombo
            Switch $iCode
                Case $CBN_EDITCHANGE ; Sent after the user has taken an action that may have altered the text in the edit control portion of a combo box
               
$m=_GUICtrlComboBox_GetCurSel($ImageCombo)
MsgBox(0,"","combo changed to item no "&$m ,0) 
                  
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_COMMAND

Share this post


Link to post
Share on other sites

Thanks alot :)

Where can I find the doku for 'GUIRegisterMsg' ?

Share this post


Link to post
Share on other sites

Thanks alot :)

Where can I find the doku for 'GUIRegisterMsg' ?

It's in the help file

http://dundats.mvps.org/help/html/function...RegisterMsg.htm

The link to my online version of the help file is in my sig.


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Great, thanks.

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