Sign in to follow this  
Followers 0
goldenix

_GUICtrlMenu_CreatePopup Q

1 post in this topic

#1 ·  Posted (edited)

Run the code & try right clicking on the Gray GUI area & click on Add To Group, All works nice & you get ConsoleWrite('Group 1' & @CRLF)

If you do the same on the Listview it wont print to console. But it should right?

#include <GuiMenu.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

Global Enum $idOpen_, $idSave, $idInfo
Global $Form1, $hListView
;~ ===========================================================
    ; Create GUI
;~ ===========================================================  
    $Form1 = GUICreate("Menu", 400, 300)
    ;~ Create listview 
    $hListView = _GUICtrlListView_Create ($Form1, "", 0, 0, 230, 215)
     _GUICtrlListView_SetExtendedListViewStyle ($hListView, BitOR($LVS_EX_FULLROWSELECT,$LVS_EX_DOUBLEBUFFER))
    ;~  ; Add columns
    _GUICtrlListView_AddColumn ($hListView, "boo",100)
    GUISetState()
    
    ; Register message handlers
    GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
    GUIRegisterMsg($WM_CONTEXTMENU, "WM_CONTEXTMENU")

;~ ===========================================================
; Handle WM_COMMAND messages
;~ ===========================================================
Func WM_COMMAND($hWnd, $iMsg, $iwParam, $ilParam)
    Switch $iwParam
        Case $idOpen_
           ConsoleWrite('Group 1' & @CRLF)
    EndSwitch
EndFunc   ;==>WM_COMMAND

;~ ===========================================================
; Handle WM_CONTEXTMENU messages
;~ ===========================================================
Func WM_CONTEXTMENU($hWnd, $iMsg, $iwParam, $ilParam)
    Local $hMenu
    
    $hMenu = _GUICtrlMenu_CreatePopup ()
    _GUICtrlMenu_InsertMenuItem ($hMenu, 0, "Add To Group", $idOpen_)
    _GUICtrlMenu_InsertMenuItem ($hMenu, 1, "Edit Groups", $idSave)
    _GUICtrlMenu_InsertMenuItem ($hMenu, 2, "Edit Filter", $idSave) 
    _GUICtrlMenu_InsertMenuItem ($hMenu, 4, "", 0)
    _GUICtrlMenu_InsertMenuItem ($hMenu, 5, "Info", $idInfo)
    _GUICtrlMenu_TrackPopupMenu ($hMenu, $iwParam)
    _GUICtrlMenu_DestroyMenu ($hMenu)
    Return True
EndFunc   ;==>WM_CONTEXTMENU


Do ; Loop until user exits
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

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