Jump to content
Sign in to follow this  
boogieoompa

Detecting next mouse click

Recommended Posts

boogieoompa

OK so I am trying to make an irregular shaped gui, in this case a circle that is divided into 9 pieces each "slice" is effectivly a button. Basically I am going to have this gui pop up whenever the user right clicks in a certain app and can select a function. However I have not found a way of making these slices actual buttons (that dont flicker) since they are not rectangular. I decided to cheat and since this is a right click menu is it possible to detect where the next mouse click is? That way I can define if the next click (following the right click that brought up the menu) is in a certain location it is on button x or is outside of the circle and should be sent to the app. I dont know of a way of monitoring mouse clicks.

Any suggestions either on how to monitor mouse clicks (specificallly the next click after a certain point) or does anyone have any code to map a very irregular shapped button?

Thanks ahead of time

Not that it matters too much with my question but heres a sample of the code I am using.

#include <GuiConstants.au3>
#include <windowsconstants.au3>
; GUI
$mousepos = mousegetpos()
$width = IniRead("config.ini", "GUI", "Width", "DEFAULT")
$height = IniRead("config.ini", "GUI", "Height", "DEFAULT")


$gui = GUICreate("Menu",$width,$height,$mousepos[0]-$width/2,$mousepos[1]-$height/2,$WS_POPUP,$WS_EX_LAYERED)
GUICtrlCreatePic("menu.bmp",0,0,$width,$height)
GuiSetIcon("Menu.ico", 0)

; BUTTON
;GuiCtrlCreateButton("Sample Button", 10, 330, 100, 30)


; GUI MESSAGE LOOP
GuiSetState()
While GuiGetMsg() <> $GUI_EVENT_CLOSE
WEnd

Share this post


Link to post
Share on other sites
dantay9

You could make a gui in place of each button. It might take a bit of math to get the window to the right shape, but then you could find the window that the mouse is over to see which "button" is clicked. I don't have the script to manipulate the window shape off hand, but it uses "SetWindowRgn" as a dllcall to change the shape. Search for that and you will find some examples about how to change the window shape.

This is the only way I can think of that will have no flickering. It isn't the easiest way and probably not the best way, but it will get the job done.

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
JohnOne

Crikey, I never even new you could make a circular gui

Now this is just a blind idea which may well be stupid, but I'll try nonetheless

Could you make these segments into groups ?

That would only work, if infact a group would detect a mouse click just as a label will.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
dantay9

Actually, the making a label in place of a button would be a great idea. You can detect clicks on a label.

Edit: If all else fails, I guess you could just measure the position of the mouse in relation to the window to see which section of the window the mouse is in.

Edited by dantay9

[font="Verdana"] [size="2"]"[/size][/font]Failure is not an option -- it comes packaged with Windows"[font="Verdana"][size="2"] Gecko Web Browser[/size][/font][font="Verdana"][size="2"], [/size][/font][font="Verdana"][size="2"]Yahtzee![/size][/font][font="Verdana"][size="2"], Toolbar Launcher (like RocketDock)[/size][/font][font="Verdana"][size="2"]Internet Blocker, Simple Calculator, Local Weather, Easy GDI+ GUI [/size][/font][font="Verdana"][size="2"]Triangle Solver, TCP File Transfer, [/size][/font][font="Verdana"][size="2"]Valuater's Autoit Wrappers[/size][/font][font="Verdana"][size="3"][size="2"][size="2"]OOP In AutoIt[/size][/size][/size][/font][font="Verdana"][size="2"][size="1"]Using Windows XP SP3, 1GB RAM, AMD Athlon Processor @ 2.1 GHzCheck me out at gadgets.freehostrocket.com[/size][/size][/font]

Share this post


Link to post
Share on other sites
boogieoompa

Great idea with the multiple guis. As far as the lables I didnt know you could make labels irregular shaped. If I set one of the lables color to transpararent wont it register the mouse click on the transparancy? I was under the impression the transparancy was just pixel level.

Thanks

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.