Right Click on Labels
Right Click on Labels
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?
Re: Right Click on Labels
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.
Re: Right Click on Labels
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.
Having this feature would be great, and pretty trivial to add.
Re: Right Click on Labels
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.
Re: Right Click on Labels
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.
Re: Right Click on Labels
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.
Re: Right Click on Labels
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.
Re: Right Click on Labels
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?
Re: Right Click on Labels
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.
Re: Right Click on Labels
That makes sense. Alright.