Page 1 of 1

Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Fri Nov 06, 2015 9:36 pm
by sritcp
Specifically, if I wanted to send a (say,) shift-click to an object, how would I script it?

Thanks,
Sri

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Fri Nov 06, 2015 11:00 pm
by dunbarx
Sri.

Would this help you make your gadget? Make two buttons and a field on a new card. In the script of btn 1:

Code: Select all

on mouseUp
   if the shiftKey is down then put "Shift" into fld 1
   else put "Click" into fld 1
end mouseUp
In btn 2:

Code: Select all

on mouseUp
   send "mouseUp" to btn 1
end mouseUp
Click on btn 2 with and without the shiftKey.

Craig

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Fri Nov 06, 2015 11:14 pm
by sritcp
Craig:

I'm afraid not.
I want to send "Shift-mouseClick" to an object by script. Say, I have no buttons, nothing.
I want the object to recognize that the mouse was clicked on it while the shift key was down.
The object's code already contains ways of handling shift-mouseClick and I don't want to mess with it (because I don't know where it is, say).
In other words, is there a message that is equivalent of a (fictitious) message
mouseUp buttonNumber, specialKeyPressed

If it is not there, I think there should be. Someone must surely have put in such a feature request in the past.

Regards,
Sri.

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Fri Nov 06, 2015 11:30 pm
by dunbarx
Sri.
I'm afraid not.
Now I am confused. What is missing, then, with simply placing the button 1 handler in the card script, and maybe adding a bit of code dealing with the target?

There is no message embellished with your extra parameter. I am not sure how you could kluge one. So, fearlessly, what is missing from the simple handler?

Craig

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Sat Nov 07, 2015 12:10 am
by bn
Hi Sri,

Code: Select all

click at the loc of button 1 with  optionKey 
Kind regards
Bernd

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Sat Nov 07, 2015 12:17 am
by sritcp
Hi Craig:

I didn't explain the context of my question in my original post.
I didn't mean to imply that your solution doesn't work. It does.
My question relates to another question posted on this board about the difficulty in highlighting multiple lines of a datagrid on mobile where there is no shift key available (when the keyboard is not invoked).
Mikey had provided a workaround.

I thought it would be simple if we put a toggle switch (checkbox....) to activate the shift key, and when the user taps the shift key and then taps a datagrid line, if we interrupt it and send "shift-click" instead, this would highlight multiple lines using the built-in mechanism (and we would then reset the shift key).
Initially, it wouldn't work when I handled the mouseUp at the Datagrid level as it was higher on the message path than I needed. I didn't want to mess with the innards.(row or column control code, which I thought I needed to).
It was in this context that I wondered if I could
dispatch "mouseUp" to the target with "1", "shiftKey"
if such a message existed.

Regards,
Sri

EDIT: Added the underlined phrase for added clarity.

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Sat Nov 07, 2015 12:21 am
by sritcp
bn wrote:

Code: Select all

click at the loc of button 1 with  optionKey 
Hi Bernd:

As you can see from my previous comment, I need to send the "shift-click" to the datagrid line that was simple-clicked.

Regards,
Sri

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Sat Nov 07, 2015 1:59 am
by FourthWorld
For the future maybe we should submit an enhancement request for the DataGrid to support the field object's toggleHilites property?

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Sat Nov 07, 2015 3:01 am
by sritcp
FourthWorld wrote:For the future maybe we should submit an enhancement request for the DataGrid to support the field object's toggleHilites property?
1. I was under the (mistaken?) impression that Datagrid was Trevor DeVore's single-handed creation which was bolted on to LiveCode's core and that no further development is being done on DataGrid (other than making it compatible with the successive versions of LC).

2. I still think an additional, optional parameter to the mouseUp, viz.,
mouseUp buttonNumber, specialKeyPressed
would add more general flexibility.

Regards,
Sri

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Sat Nov 07, 2015 3:15 am
by dunbarx
Sri.

Surely any enhancement is useful. Consider what Bernd pointed out with the "click" command. That is a good example of a perfect place to include those sorts of extra parameters.

And as long as it does not break legacy code; "mouseUp" is a message one must be careful with.

Craig

Re: Shift-/Control-/Option-CLICK; what is the message sent?

Posted: Sat Nov 07, 2015 1:58 pm
by sritcp
Craig:

1. Yes, I agree with you that one shouldn't mess with something as fundamental as the mouseUp message. It is impossible to visualize all possible consequences.

2. I took at a second look at Bernd's suggestion and I think I can use it to solve my problem (Thanks, Bernd!)
Insert in the frontscript:

Code: Select all

if shiftKeySwitchIsOn then click at the loc of the target with shiftKey
Regards,
Sri