Info("modifiers") persistence with mouse clicks


#1

Pressing a button with right mouse click, where the procedure panel says
message info"modifiers")
call “Proc_A”
and where Proc_A says
message info(“modifiers”)
I get “control rightButton” the first time, but then just “leftButton” the second time (I lose control ;).
If I hold down the control button and use the left mouse to click the button, I get “control leftButton” both times.
Is this a feature or a bug? If a feature, where can I get more info?


#2

I cannot duplicate that. With the same procedure called by a button, when I use a right click on the button, I get the message ‘control rightButton’ every time, but that is because I defined a right click as a secondary click in my mouse preferences. When I click on the left, I get ‘leftButton’ every time. control left click–> control leftButton
option left click–> option leftButton
control right click–>control rightButton
option right click–>option control rightButton.
All as expected.


#3

Thanks, Tom. I don’t think I was clear enough, though, on my results (a common occurrence ;). In the procedure panel of the button, on the form, was ‘message info(“modifiers”)’ statement and, on a right click, I would get “control rightButton”, as expected. Immediately following that statement, still in the button procedure panel, I called another procedure. That procedure had only one line: ‘message info(“modifiers”)’. It would just say “leftButton”. So, the call of an outside procedure, from the procedure panel of the button, was enough of an event to “scrub” the info(“modifiers”) memory from a right-click. If, however, I used the “control” button on the keyboard, and left clicked the button, both messages said “control leftButton”. Therefore, if I want the “control” modifier to persist beyond the procedure panel of the button, I need to use the control key. This may be a feature. If so, it can be easily accommodated. In that event, though, I’d like a little more insight into the feature part.
Panorama has always been the Swiss Army Knife of software, as I’m always finding new tools, etc. PanX even more so.


#4

Mark, I think the change in info(“modifiers”) comes about when the message dialog is closed. It looks like hitting Return or Enter is interpreted as a leftButton click as, of course, is clicking the mouse button itself.
If I only put the call to the other procedure in the Procedure panel without first having a message statement it returns the correct modifiers.


#5

Perhaps, but when I put in a message into the second procedure, in a conditional that the Info('modifiers") contains “control”, it does not trigger from a right click, but it does trigger from a control-click. (??)


#6

Strange, it works for me whether it is a plain right click or a control-left click. The Procedure panel for the button only has the call to the second procedure and the called procedure has this:

if info("modifiers") contains "control"
    message info("modifiers")
endif

#7

Further fiddling shows that if I hold the right click on the button for 1/2 sec or so, I get the conditional from the external procedure, otherwise no. When I use the keyboard, it gets it every time. Also, when I right-click, there is no button highlight, whereas left-click with the control key highlights the button. (??)
It’s a puzzlement. :wink:


#8

Bingo! The info(“modifiers”) returns the modifiers from the most recent keyboard or mouse event. If additional events happen, you’ll get the modifier from the most recent event, not the original one.

The solution is to save the modifiers in a variable. As the first line in your procedure in the button, save the modifiers.

let mods = info("modifiers")

If a subroutine needs to get at the modifiers, either pass the variable as a parameter, or make the variable a fileglobal or global so it can be used in different procedures.

Just to be clear, calling another procedure is not the cause of this problem. The same thing would happen if the code was all in one procedure. It’s the message statement that is causing the modifiers to change, because you are now getting the modifiers associated with the key or mouse click that closed the message alert, not the original click that triggered the button.