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

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

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

Post by sritcp » Fri Nov 06, 2015 9:36 pm

Specifically, if I wanted to send a (say,) shift-click to an object, how would I script it?

Thanks,
Sri

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Fri Nov 06, 2015 11:00 pm

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

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

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

Post by sritcp » Fri Nov 06, 2015 11:14 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Fri Nov 06, 2015 11:30 pm

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

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4172
Joined: Sun Jan 07, 2007 9:12 pm

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

Post by bn » Sat Nov 07, 2015 12:10 am

Hi Sri,

Code: Select all

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

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

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

Post by sritcp » Sat Nov 07, 2015 12:17 am

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.
Last edited by sritcp on Sat Nov 07, 2015 12:52 am, edited 4 times in total.

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

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

Post by sritcp » Sat Nov 07, 2015 12:21 am

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

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

Post by FourthWorld » Sat Nov 07, 2015 1:59 am

For the future maybe we should submit an enhancement request for the DataGrid to support the field object's toggleHilites property?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

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

Post by sritcp » Sat Nov 07, 2015 3:01 am

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

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10331
Joined: Wed May 06, 2009 2:28 pm

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

Post by dunbarx » Sat Nov 07, 2015 3:15 am

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

sritcp
Posts: 431
Joined: Tue Jun 05, 2012 5:38 pm

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

Post by sritcp » Sat Nov 07, 2015 1:58 pm

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

Post Reply