PDA

View Full Version : Capturing mouse double-click.



StoryWeaver
October 25th, 2019, 02:40
I was wanting to write some code that would minimize windows when you double-click the window bar on top of windows, similar to how it works on Roll20. Having to right-click and go through a menu each time is slow in comparison, particularly when you have multiple windows open that you want to keep around.

So I was wondering if it is possible to detect double mouse clicks with scripts? Similar to how you detect a single mouse click, and if any buttons are held down for example. :)

Trenloe
October 25th, 2019, 02:52
If it's a windowcontrol: https://www.fantasygrounds.com/refdoc/windowcontrol.xcp#onDoubleClick

I don't think the whole of the top bar of a window is a windowcontrol, but at least the title will be.

The problem is - I'm not sure that you can minimise a window through the FG API. You can close a window, but I can't find an API function to minimise a window.

StoryWeaver
October 25th, 2019, 03:31
Thanks Trenloe, I don't know how I missed it.

1) The idea was to get the mouse position from the top left corner of the window controller. Maybe using the window controllers getPosition() function, though it might only return pixel positions within its contents, not including the top bar. I'd need to test it out.
2) Measure out the size of the menu bar in photoshop in pixles.
3) Then minimize if the click took place within the window bar area.

Going to have to do a search through the CoreRPG code to see if I can find any minimizing code I can hook into when I next get the time.

Trenloe
October 25th, 2019, 05:33
Going to have to do a search through the CoreRPG code to see if I can find any minimizing code I can hook into when I next get the time.
I've already searched through all of my unzipped rulesets for minimize but I might have missed something. Give it a go. Good luck! :-)

LordEntrails
October 25th, 2019, 17:20
There should be something right? Since you can minimize a window bias right click radial menu currently. Maybe it just has a name other than expected?

Trenloe
October 25th, 2019, 17:37
There should be something right? Since you can minimize a window bias right click radial menu currently.
You'd think so. But that right-click menu to minimize is built into the FG application, that menu is not available in the API. And neither, it seems, is API code to minimize a window. All API code has to be decided to be made public, so maybe there's a reason minimize isn't, or maybe it's just not there, or maybe it's hidden (and not documented).

Moon Wizard
October 25th, 2019, 18:12
Nope, I checked late yesterday. There's no API to minimize. It would have to be something that is added down the road.

JPG

Bidmaron
October 25th, 2019, 18:30
There is a shortcut to evoke a radial menu from its position but away from computer. But it does no coding good because I don’t believe you can inject key commands in code.

LordEntrails
October 25th, 2019, 21:36
Sounds like someone should add it to the wishlist so Moon doesn't forget about this :)
Oh, well, even though it's not my idea, here you go!
https://fg2app.idea.informer.com/proj/fg2app?ia=129345

StoryWeaver
October 25th, 2019, 22:23
That's on hold then until we get the API for it in that case.

Thanks for that everyone, I added my vote to the wishlist for the API, unless you guys decide to bake it in to FGU at its core instead. :)