smstroble Posted November 2, 2006 Posted November 2, 2006 Ok, im making a simple program launcher that is a window full of buttons that have the prog icons and i would like to be able to right click on them and preferably cause a menu to drop from mouse, but at least cause a msgbox to pop up. problem is i cant get it to tell me what button you right clicked even using GUIgetmsg(1) not very fun... MUHAHAHAHAHA
lod3n Posted November 2, 2006 Posted November 2, 2006 Try this:#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("Event Mode GUI") GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") dim $aButtons[1] for $i = 1 to 5 redim $aButtons[$i] $aButtons[$i-1] = GUICtrlCreateButton("Button "&$i, 10, $i*30, 60) GUICtrlSetOnEvent(-1, "Buttonclick") Next GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func Buttonclick() $text = GuiCtrlRead(@GUI_CTRLID) MsgBox(0, "GUI Event", $text) EndFunc Func CLOSEClicked() Exit EndFunc [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
smstroble Posted November 3, 2006 Author Posted November 3, 2006 (edited) Try this: #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("Event Mode GUI") GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") dim $aButtons[1] for $i = 1 to 5 redim $aButtons[$i] $aButtons[$i-1] = GUICtrlCreateButton("Button "&$i, 10, $i*30, 60) GUICtrlSetOnEvent(-1, "Buttonclick") Next GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func Buttonclick() $text = GuiCtrlRead(@GUI_CTRLID) MsgBox(0, "GUI Event", $text) EndFunc Func CLOSEClicked() Exit EndFunc hmm nope, i want to know what control was right clicked on, not pressed. i could easily do that with the standard GUIGetMsg() while, select loop. Edited November 3, 2006 by smstroble MUHAHAHAHAHA
lod3n Posted November 3, 2006 Posted November 3, 2006 Oh. Okay:expandcollapse popup#include <GUIConstants.au3> global $right=0 Opt("GUIOnEventMode", 1) $mainwindow = GUICreate("Event Mode GUI") GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetOnEvent($GUI_EVENT_SECONDARYUP, "RightClick") dim $aButtons[1] for $i = 1 to 5 redim $aButtons[$i] $aButtons[$i-1] = GUICtrlCreateButton("Button "&$i, 10, $i*30, 60) GUICtrlSetOnEvent(-1, "Buttonclick") Next GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func Buttonclick($right=0) $text = GuiCtrlRead(@GUI_CTRLID) if $right = 0 then MsgBox(0, "GUI Event", "Left Click: " & $text) Else MsgBox(0, "GUI Event", "Right Click: " & $text) EndIf $right = 0 EndFunc Func RightClick() $right=1 MouseClick("left") EndFunc Func CLOSEClicked() Exit EndFunc [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]
smstroble Posted November 3, 2006 Author Posted November 3, 2006 Perfect, thank you very much MUHAHAHAHAHA
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