Sign in to follow this  
Followers 0
Dancellot

Need some help with TOOLBARS, POPup MENUS...

8 posts in this topic

#1 ·  Posted (edited)

Hi...

I´m new in autoit world (well... in development world in all indeed...) so, i´m triyng to findout a way to write a menu item string from a popup menu to a INI file. One detail is that the menuitems are dynamically created. Because this, i can´t do (i guess) previously assign any variable to menuitem´s cmdIDs.

Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
    Local $tNMTOOLBAR, $tNMTBHOTITEM, $hMenu
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $idFrom = DllStructGetData($tNMHDR, "IDFrom")
    $code = DllStructGetData($tNMHDR, "Code")
    Switch $hwndFrom
        Case $toolbar
            Switch $code
                Case $NM_LDOWN
                    Select
                        Case $iItem = $perfil
                            If _GUICtrlToolbar_GetButtonState($toolbar, $perfil) = 6 Then
                                GUICtrlSetData($apply, "Editar")
                                GUICtrlSetState($dhcp, $GUI_DISABLE)
                                $mode = "config"
                            Else
                                GUICtrlSetData($apply, "Aplicar")
                                GUICtrlSetState($dhcp, $GUI_ENABLE)
                                $mode = "user"
                            EndIf
                        Case $iItem = $proxy
                            If _GUICtrlToolbar_GetButtonState($toolbar, $proxy) = 6 Then
                                proxy("on")
                            Else
                                proxy("off")
                            EndIf
                    EndSelect
                Case $TBN_HOTITEMCHANGE
                    $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
                    $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
                    $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
                    $iItem = $i_idNew
                Case $TBN_DROPDOWN
                    $hMenu = _GUICtrlMenu_CreatePopup()
                    For $i = 1 to $intitens[0] ; array with the items to be created dynamically
                        _GUICtrlMenu_AddMenuItem($hMenu, $intitens[$i], 2000 + $i)
                    Next
                    _GUICtrlMenu_TrackPopupMenu($hMenu, $toolbar)
                    _GUICtrlMenu_DestroyMenu($hMenu)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_NOTIFY

also, i don´t know yet how to do the select/switch structure for a "dynamic" menu intems :mellow: ... but, one problem for time...

any help will be appreciated...

ohh... sorry for ugly inglish.

Edited by Dancellot

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

Must you handle WM_NOTIFY yourself? You can just use Opt("GuiOnEventMode", 1) and then regular event mode GUI functions:

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <Array.au3> ; Only for _ArrayDisplay()

Opt("GuiOnEventMode", 1)

Global $iButtonCnt = 3, $iMenuCnt = 4, $iItemCnt = 5
Global $iItem, $aMenuItems[$iMenuCnt * $iItemCnt + 1][2]
Global $hGUI, $idMenu
$hGUI = GUICreate("My GUI menu", 400, 40 + (50 * $iButtonCnt))
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

For $n = 1 To $iButtonCnt
    GUICtrlCreateButton("Button " & $n, 150, 20 + (50 * ($n - 1)), 100, 30)
    GUICtrlSetOnEvent(-1, "_ButtonHit")
Next

$iItem = 1
For $m = 1 To $iMenuCnt
    $idMenu = GUICtrlCreateMenu("Menu&" & $m)
    For $i = 1 To $iItemCnt
        $aMenuItems[$iItem][0] = GUICtrlCreateMenuItem("Item " & $m & "-" & $i, $idMenu)
        $aMenuItems[$iItem][1] = "Item " & $m & "-" & $i
        GUICtrlSetOnEvent(-1, "_MenuHit")
        $iItem += 1
    Next
Next
$aMenuItems[0][0] = UBound($aMenuItems) - 1

GUISetState()

_ArrayDisplay($aMenuItems, "$aMenuItems")

While 1
    Sleep(10)
WEnd

Func _ButtonHit()
    Local $sText = ControlGetText(@GUI_WinHandle, "", @GUI_CtrlId)
    ConsoleWrite("Button Hit:  @GUI_WinHandle = " & @GUI_WinHandle & "; @GUI_CtrlId = " & @GUI_CtrlId & "; Text = " & $sText & @LF)
EndFunc

Func _MenuHit()
    Local $sText = ""
    Local $iFound = _ArraySearch($aMenuItems, @GUI_CtrlId, 1, 0, 0, 0, 1, 0)
    If $iFound Then $sText = $aMenuItems[$iFound][1]
    ConsoleWrite("Menu Hit:  @GUI_WinHandle = " & @GUI_WinHandle & "; @GUI_CtrlId = " & @GUI_CtrlId & "; Text = " & $sText & @LF)
EndFunc

Func _Quit()
    Exit
EndFunc

Note that menu items don't return text by their control ID, hence the array to keep track of menu item text, but not required for the buttons.

Change the values of $iButtonCnt, $iMenuCnt, $iItemCnt to simulate dynamic inputs that could come from anywhere, (like IniReadSection().

:mellow:

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Must you handle WM_NOTIFY yourself? You can just use Opt("GuiOnEventMode", 1) and then regular event mode GUI functions:

...

Note that menu items don't return text by their control ID, hence the array to keep track of menu item text, but not required for the buttons.

Change the values of $iButtonCnt, $iMenuCnt, $iItemCnt to simulate dynamic inputs that could come from anywhere, (like IniReadSection().

:mellow:

PsaltyDS, 1st of all, thx for the reply, very nice your example but... btw, i never code a script in OnEvent mode.

how do i get toolbar buttons to work in GuiOnEvent mode? I want use your example but with toolbar buttons in $BTNS_WHOLEDROPDOWN style instead.

Every toolbar example script in autoit help that i examine, work in message loop + WM_COMMAND/WM_NOTIFY :P. Can you post some basic example?

Thx.

Share this post


Link to post
Share on other sites

Note that menu items don't return text by their control ID<snip>

Change the values of $iButtonCnt, $iMenuCnt, $iItemCnt to simulate dynamic inputs that could come from anywhere, (like IniReadSection().

:mellow:

To do it in a MsgLoop I usually just create 2 dummy controls to use as references

$Dum_MenuStart = GUICtrlCreateDummy()
;; Create the dynamic menu items here
$Dum_MenuEnd = GUICtrlCreateDummy()

And in the MsgLoop Switch statement

Case $Dum_MenuStart To $Dum_MenuEnd
    $sMenuText = GUICtrlRead($Msg, 1);;  We can indeed use GUICtrlRead to get the text of a menu or menuitem

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

PsaltyDS, 1st of all, thx for the reply, very nice your example but... btw, i never code a script in OnEvent mode.

how do i get toolbar buttons to work in GuiOnEvent mode? I want use your example but with toolbar buttons in $BTNS_WHOLEDROPDOWN style instead.

Every toolbar example script in autoit help that i examine, work in message loop + WM_COMMAND/WM_NOTIFY :P. Can you post some basic example?

Sure you can run it in event mode, but that has no impact on Toolbars, because they are not native AutoIt controls. There is not GuiCtrlCreateToolbar(), you instead use _GuiCtrlToolbar_Create() from the UDF. UDF controls are outside the scope of AutoIt's native event functions.

For example, here are all the changes you have to make to the example script in the help file under _GuiCtrlToolbar_Create() to switch it to event mode:

; ...

Opt('GuiOnEventMode', 1)

; ...

_Main()

Func _Main()
    
    ; ...

    ; Create GUI
    $hGUI = GUICreate("Toolbar", 600, 400)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

    ; ...

    ; Loop until user exits
    Do
        Sleep(10)
    Until 0

EndFunc  ;==> _Main

Func _Quit()
    Exit
EndFunc

; ...

No change to the code handling the toolbar, but you could have other native AutoIt controls in the GUI that would be operating in event mode now. Any UDF controls, however, you must register handlers for (i.e. WM_NOTIFY).

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Further modification of the help file example for _GuiCtrlToolbar_Create(), creating buttons based on a 2D array ($aInputs), which might have come from IniReadSection():

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <Array.au3>

Opt('MustDeclareVars', 1)
Opt('GuiOnEventMode', 1)

; This array simulates the results of IniReadSection()
; $STD_FILENEW = 6; $STD_FILEOPEN = 7; $STD_FILESAVE = 8; $STD_HELP = 11
Global $aInputs[6][2] = [[5, ""], _
        ["Button", "FileNew"], _
        ["Button", "FileOpen"], _
        ["Button", "FileSave"], _
        ["Separator", ""], _
        ["Button", "Help"]]

; Array of toolbar button command IDs
Global $aTB_IDs[$aInputs[0][0] + 1][2] = [[$aInputs[0][0], ""]]

Global $hToolbar, $iMemo
Global $iItem ; Command identifier of the button associated with the notification.

_Main()

Func _Main()
    Local $hGUI, $aSize, $iIcon

    ; Create GUI
    $hGUI = GUICreate("Toolbar", 600, 400)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

    $hToolbar = _GUICtrlToolbar_Create($hGUI)
    $aSize = _GUICtrlToolbar_GetMaxSize($hToolbar)

    $iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

    ; Add standard system bitmaps
    _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

    ; Add buttons
    $iItem = 1000
    For $n = 1 To $aInputs[0][0]
        Switch $aInputs[$n][0]
            Case "Button"
                $aTB_IDs[$n][0] = $iItem
                Switch $aInputs[$n][1]
                    Case "FileNew"
                        $aTB_IDs[$n][1] = "File - New"
                        $iIcon = $STD_FILENEW
                    Case "FileOpen"
                        $aTB_IDs[$n][1] = "File - Open"
                        $iIcon = $STD_FILEOPEN
                    Case "FileSave"
                        $aTB_IDs[$n][1] = "File - Save"
                        $iIcon = $STD_FILESAVE
                    Case "Help"
                        $aTB_IDs[$n][1] = "Help"
                        $iIcon = $STD_HELP
                    Case Else
                        $aTB_IDs[$n][1] = "" ; Error
                        $iIcon = -2
                EndSwitch
                _GUICtrlToolbar_AddButton($hToolbar, $iItem, $iIcon)

            Case "Separator"
                _GUICtrlToolbar_AddButtonSep($hToolbar)
        EndSwitch
        $iItem += 1
    Next

    ; Loop until user exits
    Do
        Sleep(10)
    Until 0

EndFunc   ;==>_Main

; Quit script
Func _Quit()
    Exit
EndFunc   ;==>_Quit

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

; WM_NOTIFY event handler
Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld, $sButtonName
    Local $tNMTOOLBAR, $tNMTBHOTITEM
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $idFrom = DllStructGetData($tNMHDR, "IDFrom")
    $code = DllStructGetData($tNMHDR, "Code")
    Switch $hwndFrom
        Case $hToolbar
            Switch $code
                Case $NM_LDOWN
                    $sButtonName = _GetTBName($iItem)
                    ;----------------------------------------------------------------------------------------------
                    MemoWrite("$NM_LDOWN: Clicked '" & $sButtonName & "'; Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex($hToolbar, $iItem))
                    ;----------------------------------------------------------------------------------------------
                Case $TBN_HOTITEMCHANGE
                    $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
                    $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
                    $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
                    $iItem = $i_idNew
                    $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
                    If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then
                        MemoWrite("$HICF_LEAVING: " & $i_idOld)
                    Else
                        $sButtonName = _GetTBName($iItem)
                        ;----------------------------------------------------------------------------------------------
                        MemoWrite("$TBN_HOTITEMCHANGE: $iItem = " & $iItem & "; '" & $sButtonName & "'")
                        ;----------------------------------------------------------------------------------------------
                    EndIf
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_NOTIFY

Func _GetTBName($iIn)
    Local $iFound = _ArraySearch($aTB_IDs, $iIn, 1, 0, 0, 0, 1, 0)
    If @error Then
        Return "<Not Found>"
    Else
        Return $aTB_IDs[$iFound][1]
    EndIf
EndFunc   ;==>_GetTBName

The buttons are created from INI file input (simulated by $aInputs).

Another array ($aTB_IDs) is populated with the dynamic command IDs and purpose of each button, and is searched to determine which button is sending messages (by _GetTBName()).

Voila', dynamic toolbar buttons.

The GUI is still in event mode, but that is completely irrelevant to the UDF-based toolbar.

:mellow:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

...because they are not native AutoIt controls. There is not GuiCtrlCreateToolbar(), you instead use _GuiCtrlToolbar_Create() from the UDF. UDF controls are outside the scope of AutoIt's native event functions...

Oh my!! I never pay attention to this... :P

OK, i have change my main gui to onevent and adapt your 1st post code to it and works perfectly... but i leave all other gui childs in msgloop mode to avoid rework in the variables structures scope and avalanche of functions... :party: ... i don´t know what are the consequences of this "mixmode" or even, if its legal but... is working!

Further modification of the help file example for _GuiCtrlToolbar_Create(), creating buttons based on a 2D array ($aInputs), which might have come from IniReadSection():

#include <GuiToolbar.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <Array.au3>

Opt('MustDeclareVars', 1)
Opt('GuiOnEventMode', 1)

; This array simulates the results of IniReadSection()
; $STD_FILENEW = 6; $STD_FILEOPEN = 7; $STD_FILESAVE = 8; $STD_HELP = 11
Global $aInputs[6][2] = [[5, ""], _
        ["Button", "FileNew"], _
        ["Button", "FileOpen"], _
        ["Button", "FileSave"], _
        ["Separator", ""], _
        ["Button", "Help"]]

; Array of toolbar button command IDs
Global $aTB_IDs[$aInputs[0][0] + 1][2] = [[$aInputs[0][0], ""]]

Global $hToolbar, $iMemo
Global $iItem ; Command identifier of the button associated with the notification.

_Main()

Func _Main()
    Local $hGUI, $aSize, $iIcon

    ; Create GUI
    $hGUI = GUICreate("Toolbar", 600, 400)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")

    $hToolbar = _GUICtrlToolbar_Create($hGUI)
    $aSize = _GUICtrlToolbar_GetMaxSize($hToolbar)

    $iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()
    GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY")

    ; Add standard system bitmaps
    _GUICtrlToolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR)

    ; Add buttons
    $iItem = 1000
    For $n = 1 To $aInputs[0][0]
        Switch $aInputs[$n][0]
            Case "Button"
                $aTB_IDs[$n][0] = $iItem
                Switch $aInputs[$n][1]
                    Case "FileNew"
                        $aTB_IDs[$n][1] = "File - New"
                        $iIcon = $STD_FILENEW
                    Case "FileOpen"
                        $aTB_IDs[$n][1] = "File - Open"
                        $iIcon = $STD_FILEOPEN
                    Case "FileSave"
                        $aTB_IDs[$n][1] = "File - Save"
                        $iIcon = $STD_FILESAVE
                    Case "Help"
                        $aTB_IDs[$n][1] = "Help"
                        $iIcon = $STD_HELP
                    Case Else
                        $aTB_IDs[$n][1] = "" ; Error
                        $iIcon = -2
                EndSwitch
                _GUICtrlToolbar_AddButton($hToolbar, $iItem, $iIcon)

            Case "Separator"
                _GUICtrlToolbar_AddButtonSep($hToolbar)
        EndSwitch
        $iItem += 1
    Next

    ; Loop until user exits
    Do
        Sleep(10)
    Until 0

EndFunc   ;==>_Main

; Quit script
Func _Quit()
    Exit
EndFunc   ;==>_Quit

; Write message to memo
Func MemoWrite($sMessage = "")
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

; WM_NOTIFY event handler
Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld, $sButtonName
    Local $tNMTOOLBAR, $tNMTBHOTITEM
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $idFrom = DllStructGetData($tNMHDR, "IDFrom")
    $code = DllStructGetData($tNMHDR, "Code")
    Switch $hwndFrom
        Case $hToolbar
            Switch $code
                Case $NM_LDOWN
                    $sButtonName = _GetTBName($iItem)
                    ;----------------------------------------------------------------------------------------------
                    MemoWrite("$NM_LDOWN: Clicked '" & $sButtonName & "'; Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex($hToolbar, $iItem))
                    ;----------------------------------------------------------------------------------------------
                Case $TBN_HOTITEMCHANGE
                    $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
                    $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
                    $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
                    $iItem = $i_idNew
                    $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
                    If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then
                        MemoWrite("$HICF_LEAVING: " & $i_idOld)
                    Else
                        $sButtonName = _GetTBName($iItem)
                        ;----------------------------------------------------------------------------------------------
                        MemoWrite("$TBN_HOTITEMCHANGE: $iItem = " & $iItem & "; '" & $sButtonName & "'")
                        ;----------------------------------------------------------------------------------------------
                    EndIf
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_NOTIFY

Func _GetTBName($iIn)
    Local $iFound = _ArraySearch($aTB_IDs, $iIn, 1, 0, 0, 0, 1, 0)
    If @error Then
        Return "<Not Found>"
    Else
        Return $aTB_IDs[$iFound][1]
    EndIf
EndFunc   ;==>_GetTBName

The buttons are created from INI file input (simulated by $aInputs).

Another array ($aTB_IDs) is populated with the dynamic command IDs and purpose of each button, and is searched to determine which button is sending messages (by _GetTBName()).

Voila', dynamic toolbar buttons.

The GUI is still in event mode, but that is completely irrelevant to the UDF-based toolbar.

:mellow:

Veeeeeeeeeeeeeeeeeeryyyy NIIIICE man...

I´ll try this later... for now, im very tired :party:

To do it in a MsgLoop I usually just create 2 dummy controls to use as references

$Dum_MenuStart = GUICtrlCreateDummy()
;; Create the dynamic menu items here
$Dum_MenuEnd = GUICtrlCreateDummy()

And in the MsgLoop Switch statement

Case $Dum_MenuStart To $Dum_MenuEnd
    $sMenuText = GUICtrlRead($Msg, 1);;  We can indeed use GUICtrlRead to get the text of a menu or menuitem

hmmm... very interesting... although i already to have what i wanted with PsaltyDS´s code, it´s good to learn how to do this in msgloop. GEOSoft, i pay some time to adapt you example in my code but i don´t get it. How can i adapt it in the example below, in order to get dynamic menu items?:

#include <GUIConstantsEx.au3>

GUICreate("Hello World", 200, 100)
GUICtrlCreateLabel("Hello world! How are you?", 30, 10)
$okbutton = GUICtrlCreateButton("OK", 70, 50, 60)
GUISetState(@SW_SHOW)

While 1
  $msg = GUIGetMsg()

  Select
    Case $msg = $okbutton
      MsgBox(0, "GUI Event", "You pressed OK!")

    Case $msg = $GUI_EVENT_CLOSE
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
      ExitLoop
  EndSelect
WEnd

Thx...

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Change it to a Switch statement

While 1
  $msg = GUIGetMsg()

  Switch $Msg
    Case $okbutton
      MsgBox(0, "GUI Event", "You pressed OK!")

    Case $GUI_EVENT_CLOSE
      MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
      ExitLoop
    Case $Ctrl_1, $Ctrl_10 ;; This means if the message is from $Ctrl_1 OR $Ctrl_10 (comma separation)
      ;; Do something
    Case $Ctrl_2 To $Ctrl_09 ;; Any control from $Ctrl_2 TO $Ctrl_9
      ;; Do something else
    Case $Dum_MenuStart To $Dum_MenuEnd
      ;Do like I did in the code in my last reply.  You can reference these items using $Msg as in GUICtrlRead($Msg, 1) to read the text of the MenuItems
  EndSwitch
WEnd
Edited by GEOSoft

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

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