Jump to content



Photo

Contextmenu with mouse left button


  • Please log in to reply
7 replies to this topic

#1 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 06:08 PM

Hi,

Its possible to create a context menu trigged by the left button of the mouse?

$context = GUICtrlCreateContextMenu($icon) ;trigged by the left button mouse's $contextItem1 = GUICtrlCreateMenu("1st", $context)


I set the context menu to a icon, but I want it open with the left in stead of the right one.

hope there's a way :oops:

Heroes, there is no such thing






#2 somdcomputerguy

somdcomputerguy

  • Active Members
  • PipPipPipPipPipPip
  • 2,368 posts

Posted 27 February 2012 - 06:23 PM

Try this. It's not perfect, sometimes a second single left click is required.
#include <Misc.au3> $dll = DllOpen("user32.dll") While 1     Sleep (10)     If _IsPressed("01", $dll) Then         MouseClick("Right")         ExitLoop     EndIf WEnd DllClose($dll)

- Bruce /* somdcomputerguy */If you change the way you look at things, the things you look at change.

#3 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 07:43 PM

Try this. It's not perfect, sometimes a second single left click is required.

#include <Misc.au3> $dll = DllOpen("user32.dll") While 1     Sleep (10)     If _IsPressed("01", $dll) Then         MouseClick("Right")         ExitLoop     EndIf WEnd DllClose($dll)

hum...there's some function about mousehover?, like, when mouse is hover $icon, it does something (change the cursor settings)?

Heroes, there is no such thing


#4 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 6,797 posts

Posted 27 February 2012 - 08:36 PM

What is it that you are trying to do? Your last post is very vague, it would help if you tried to explain what you're attempting in a clearer way. Also, what have you tried that isn't working correctly?

How to ask questions the smart way!

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.

Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.

_FileGetProperty - Retrieve the properties of a file SciTE Toolbar - A toolbar demo for use with the SciTE editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.

GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips.

Posted Image


#5 Aipion

Aipion

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 27 February 2012 - 09:00 PM

DiOgO

Have a look at my example.

AutoIt         
#include <GuiMenu.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $msg Global Enum $i_MenuItem1 = 3335, $i_MenuItem2, $i_MenuItem3, $i_MenuItem4, $i_MenuItem5     $iGUI = GUICreate("My GUI") ; will create a dialog box that when displayed is centered $My_icon = GUICtrlCreateIcon(@AutoItExe,-1,10,10,64,64)     GUISetState(@SW_SHOW)     ; Run the GUI until the dialog is closed     While 1         $msg = GUIGetMsg() Switch $msg Case $My_icon Global $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, 'Add Files...', $i_MenuItem1) _GUICtrlMenu_AddMenuItem($hMenu, 'Add Folders...', $i_MenuItem2) _GUICtrlMenu_AddMenuItem($hMenu, 'Add Temporary Files...', $i_MenuItem3) _GUICtrlMenu_AddMenuItem ($hMenu, "", 0) _GUICtrlMenu_AddMenuItem($hMenu, 'Add External Files...', $i_MenuItem4) _GUICtrlMenu_AddMenuItem($hMenu, 'New Shortcut...', $i_MenuItem5) $hMenu_MSGS = _GUICtrlMenu_TrackPopupMenu ($hMenu, $iGUI, -1,-1,1,1,2) _GUICtrlMenu_DestroyMenu ($hMenu) Switch $hMenu_MSGS Case $i_MenuItem1 MsgBox(0,"","You Clicked Menu Item 1") Case $i_MenuItem2 MsgBox(0,"","You Clicked Menu Item 2") Case $i_MenuItem3 MsgBox(0,"","You Clicked Menu Item 3") Case $i_MenuItem4 MsgBox(0,"","You Clicked Menu Item 4") Case $i_MenuItem5 MsgBox(0,"","You Clicked Menu Item 5") Case Else ;ConsoleWrite("Error") EndSwitch Case $GUI_EVENT_CLOSE ExitLoop EndSwitch     WEnd     GUIDelete()

In Development - Setup Fusion

Library - Page Menu Control

Antonio Do Rosario

#6 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 09:05 PM

DiOgO

Have a look at my example.

AutoIt         
#include <GuiMenu.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Local $msg Global Enum $i_MenuItem1 = 3335, $i_MenuItem2, $i_MenuItem3, $i_MenuItem4, $i_MenuItem5     $iGUI = GUICreate("My GUI") ; will create a dialog box that when displayed is centered $My_icon = GUICtrlCreateIcon(@AutoItExe,-1,10,10,64,64)     GUISetState(@SW_SHOW)     ; Run the GUI until the dialog is closed     While 1         $msg = GUIGetMsg() Switch $msg Case $My_icon Global $hMenu = _GUICtrlMenu_CreatePopup() _GUICtrlMenu_AddMenuItem($hMenu, 'Add Files...', $i_MenuItem1) _GUICtrlMenu_AddMenuItem($hMenu, 'Add Folders...', $i_MenuItem2) _GUICtrlMenu_AddMenuItem($hMenu, 'Add Temporary Files...', $i_MenuItem3) _GUICtrlMenu_AddMenuItem ($hMenu, "", 0) _GUICtrlMenu_AddMenuItem($hMenu, 'Add External Files...', $i_MenuItem4) _GUICtrlMenu_AddMenuItem($hMenu, 'New Shortcut...', $i_MenuItem5) $hMenu_MSGS = _GUICtrlMenu_TrackPopupMenu ($hMenu, $iGUI, -1,-1,1,1,2) _GUICtrlMenu_DestroyMenu ($hMenu) Switch $hMenu_MSGS Case $i_MenuItem1 MsgBox(0,"","You Clicked Menu Item 1") Case $i_MenuItem2 MsgBox(0,"","You Clicked Menu Item 2") Case $i_MenuItem3 MsgBox(0,"","You Clicked Menu Item 3") Case $i_MenuItem4 MsgBox(0,"","You Clicked Menu Item 4") Case $i_MenuItem5 MsgBox(0,"","You Clicked Menu Item 5") Case Else ;ConsoleWrite("Error") EndSwitch Case $GUI_EVENT_CLOSE ExitLoop EndSwitch     WEnd     GUIDelete()

works great :oops:

can I also put check marks in some items?

Heroes, there is no such thing


#7 Aipion

Aipion

    Prodigy

  • Active Members
  • PipPipPip
  • 191 posts

Posted 27 February 2012 - 09:07 PM

works great :oops:

can I also put check marks in some items?

Yes you can Via _GUICtrlMenu_SetItemChecked($hMenu, $iItem [, $fState = True [, $fByPos = True]])

In Development - Setup Fusion

Library - Page Menu Control

Antonio Do Rosario

#8 DiOgO

DiOgO

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 331 posts

Posted 27 February 2012 - 09:47 PM

Yes you can Via _GUICtrlMenu_SetItemChecked($hMenu, $iItem [, $fState = True [, $fByPos = True]])

yeah, ahah, thanks again :oops:

Heroes, there is no such thing





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users