Jump to content

GUICtrlCreateContextMenu with _GUICtrlListView_Create


Recommended Posts

These aren't mixing very well. Is there a way to solve this without using GUICtrlListViewCreate?

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

$GUI = GUICreate("(UDF Created) ListView Destroy", 400, 300)

$hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
$context = GUICtrlCreateContextMenu($hListView) 
GUICtrlCreateMenuItem('Testing', $context)

$HandleBefore = $hListView
GUISetState()

; Add columns
_GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
_GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
_GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

; Add items
_GUICtrlListView_AddItem($hListView, "Row 1: Col 1")
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
_GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
_GUICtrlListView_AddItem($hListView, "Row 2: Col 1")
_GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
_GUICtrlListView_AddItem($hListView, "Row 3: Col 1")

; Loop until user exits
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
GUIDelete()
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

These aren't mixing very well. Is there a way to solve this without using GUICtrlListViewCreate?

#include <GuiConstantsEx.au3>
 #include <GuiListView.au3>
 
 $GUI = GUICreate("(UDF Created) ListView Destroy", 400, 300)
 
 $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
 $context = GUICtrlCreateContextMenu($hListView) 
 GUICtrlCreateMenuItem('Testing', $context)
 
 $HandleBefore = $hListView
 GUISetState()
 
; Add columns
 _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
 _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
 _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)
 
; Add items
 _GUICtrlListView_AddItem($hListView, "Row 1: Col 1")
 _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
 _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
 _GUICtrlListView_AddItem($hListView, "Row 2: Col 1")
 _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
 _GUICtrlListView_AddItem($hListView, "Row 3: Col 1")
 
; Loop until user exits
 Do
 Until GUIGetMsg() = $GUI_EVENT_CLOSE
 GUIDelete()
Have a look at this post and the next one.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...