Right Click on Labels

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Right Click on Labels

Post by Jor'Mox »

If I wanted to make a label do different things depending on if I right or left click on it, what would be the best way to get the right click behavior to happen? I see that there is a button press event, which I haven't messed with much yet, but based on the documentation that seems to only fire when the button is pressed (not when it is released which would make a complete click), and it only passes x and y coords to identify where it is at, meaning I would need to independently track the area occupied by a label and only respond if the click falls in the right place. Are there any better options, or is that really all there is to work with?

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Right Click on Labels

Post by Jor'Mox »

So, I dug a bit more, and messed around with things a bit. I can see how I would get the click events, though there does not seem to be a ButtonRelease event firing when the right mouse button is released, like there is for the left mouse button. Also, the click related events only seem to happen for the main window, not when clicking on labels, miniconsoles, or anything else.

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Right Click on Labels

Post by phasma »

Yeah. So far as I recall, these events are only available for the main window. I used them briefly to move my UI elements around, but quickly gave up.

Having this feature would be great, and pretty trivial to add.

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Right Click on Labels

Post by phasma »

Actually, come to think of it, maybe it's possible to use these events in tandem with the label mouseover events. Set a var when the event is raised and keep it as true until the off event hits and work from that. Ugly, but I think it would work.

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Right Click on Labels

Post by Jor'Mox »

The problem is that there are no mouse click events of any kind generated when clicking on a label, as far as I can tell. So while you can track the mouse going on and off of a label, you can't tell if they clicked on it, aside from using the clickCallback functionality, which doesn't respond to right clicks. If there were a setLabelRightClickCallback function, that would be awesome.

phasma
Posts: 191
Joined: Sat Aug 03, 2013 7:00 pm
Discord: phasma#4694

Re: Right Click on Labels

Post by phasma »

Am sure there are events for this. I, albeit, very briefly, did code something to move labels around. Can't remember how as it was before I landed myself in hospital, so my memory could well be playing tricks on me, but check further. I definitely had -something- working.

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Right Click on Labels

Post by Jor'Mox »

I believe you that there are events for such things, but they don't seem to be documented anywhere that I can find. Specifically, the sysWindowMousePressEvent and sysWindowMouseReleaseEvent events do not provide any interaction with labels.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Right Click on Labels

Post by Vadi »

They provide their x,y coordinates, so you would have to do work to work out which labels is below that. Not ideal, but feasible?

Jor'Mox
Posts: 1142
Joined: Wed Apr 03, 2013 2:19 am

Re: Right Click on Labels

Post by Jor'Mox »

I was testing those events, and, at least for labels that have a click callback set, those events do not get raised when they are clicked on. If they were, I could work it out.

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Right Click on Labels

Post by Vadi »

That makes sense. Alright.

Post Reply