Sturmi Posted June 2, 2016 Author Share Posted June 2, 2016 Case $NM_RCLICK ;My Context Menu so i just add it to the wm command function like this ? Link to comment Share on other sites More sharing options...
kcvinu Posted June 2, 2016 Share Posted June 2, 2016 You need check for this event - "$GUI_EVENT_SECONDARYDOWN" call the GUIGetCursorInfo unction inside this event. you will get an array with 5 elements. 5th element is the control handel. If that is your list box, then show your context menu. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
kcvinu Posted June 2, 2016 Share Posted June 2, 2016 this is one method Global $Form1 = GUICreate("Form1", 611, 430, 286, 158) GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "Your Function") Func Your Function() ;Call GUIGetCursorInfo function here ; And do the context menu works too here EndFunc Sturmi 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
kcvinu Posted June 2, 2016 Share Posted June 2, 2016 But one draw back of this method is that, this will trigger your context menu, whenever user right clicks on list box. In any area of the list box. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
Sturmi Posted June 2, 2016 Author Share Posted June 2, 2016 that wouldn't be a huge problem as i have one select per time and one gets selected right away so you cant open it without one selected. thanks alot. helped a ton Link to comment Share on other sites More sharing options...
kcvinu Posted June 2, 2016 Share Posted June 2, 2016 (edited) Then ok Edited June 2, 2016 by kcvinu Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
kcvinu Posted June 2, 2016 Share Posted June 2, 2016 Here is a sample code expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("Form1", 611, 430, 286, 158) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") GUISetOnEvent($GUI_EVENT_MINIMIZE, "Form1Minimize") GUISetOnEvent($GUI_EVENT_MAXIMIZE, "Form1Maximize") GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "RightClick") Global $Button1 = GUICtrlCreateButton("Button1", 232, 312, 153, 65) GUICtrlSetOnEvent(-1, "Button1Click") Global $List1 = GUICtrlCreateList("", 40, 88, 161, 175) GUICtrlSetOnEvent(-1, "List1Click") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $Items = ['one','two','three','four'] Local $ConMenu Local $MenuItem1 For $i = 0 To 3 GUICtrlSetData($List1, $Items[$i]) Next While 1 Sleep(100) WEnd Func Button1Click() EndFunc Func Form1Close() Exit EndFunc Func Form1Maximize() EndFunc Func Form1Minimize() EndFunc Func RightClick() Local $sArray = GUIGetCursorInfo($Form1) If $sArray[4] = $List1 Then $ConMenu = GUICtrlCreateContextMenu($List1) $MenuItem1 = GUICtrlCreateMenuItem("Item1", $ConMenu) EndIf EndFunc Func List1Click() EndFunc Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. 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) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now