Getting whether specific key is currently pressed

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting whether specific key is currently pressed

Jan Blizničenko
Hello

I would like to ask whether is there any way to directly find out if specific key (shift in my case) is currently pressed. I am trying to implement own multi-selection of elements drawn on Roassal canvas, but I do not receive original MouseClick/Drag/whatever event with shiftKeyPressed, but I receive only Roassal selection event without this kind of information. It would require lots of modifications on Roassal part to forward such info (although it would be possible I suppose), so I am looking for a way to bypass it.

Any help is appreciated.

Jan Blizničenko
Reply | Threaded
Open this post in threaded view
|

Re: Getting whether specific key is currently pressed

Peter Uhnak
Mouse and keyboard events are usually captured by TRMorph and then converted into Roassal events, so check there.

Peter

On Sat, Feb 13, 2016 at 4:06 PM, Jan Blizničenko <[hidden email]> wrote:
Hello

I would like to ask whether is there any way to directly find out if
specific key (shift in my case) is currently pressed. I am trying to
implement own multi-selection of elements drawn on Roassal canvas, but I do
not receive original MouseClick/Drag/whatever event with shiftKeyPressed,
but I receive only Roassal selection event without this kind of information.
It would require lots of modifications on Roassal part to forward such info
(although it would be possible I suppose), so I am looking for a way to
bypass it.

Any help is appreciated.

Jan Blizničenko



--
View this message in context: http://forum.world.st/Getting-whether-specific-key-is-currently-pressed-tp4877401.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: Getting whether specific key is currently pressed

Jan Blizničenko
That's true, but I'm not sure that modifying TRMorph, TRMouseDragStart and TRMouseDragEnd is the right way to go here, so I'm interested in finding simpler solution if there is any.

Jan

Peter Uhnák wrote
Mouse and keyboard events are usually captured by TRMorph and then
converted into Roassal events, so check there.

Peter

On Sat, Feb 13, 2016 at 4:06 PM, Jan Blizničenko <[hidden email]>
wrote:

> Hello
>
> I would like to ask whether is there any way to directly find out if
> specific key (shift in my case) is currently pressed. I am trying to
> implement own multi-selection of elements drawn on Roassal canvas, but I do
> not receive original MouseClick/Drag/whatever event with shiftKeyPressed,
> but I receive only Roassal selection event without this kind of
> information.
> It would require lots of modifications on Roassal part to forward such info
> (although it would be possible I suppose), so I am looking for a way to
> bypass it.
>
> Any help is appreciated.
>
> Jan Blizničenko
>
>
>
> --
> View this message in context:
> http://forum.world.st/Getting-whether-specific-key-is-currently-pressed-tp4877401.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Getting whether specific key is currently pressed

Henrik Nergaard
Quick and dirty: "Sensor shiftPressed"

The modification keys (shift/ctrl/alt/cmd?) is available at the MorphicEvent side see the class UserInputEvent (variable buttons + protocol modifier state).
Adding a variable to TRAbstractMouseEvent (removing those at TRAbstractMouseClick) which hold this information
+ the same messages as in "modifier stae"
+ in each rtMouse... method in RTMorph add a line setting the button state from the evt argument to the RTEvent type (for example "ee modifierState: evt buttons") should make this information available for any mouse event in Roassal.

Best regards,
Henrik

-----Original Message-----
From: Pharo-users [mailto:[hidden email]] On Behalf Of Jan Bliznicenko
Sent: Saturday, February 13, 2016 8:27 PM
To: [hidden email]
Subject: Re: [Pharo-users] Getting whether specific key is currently pressed

That's true, but I'm not sure that modifying TRMorph, TRMouseDragStart and TRMouseDragEnd is the right way to go here, so I'm interested in finding simpler solution if there is any.

Jan


Peter Uhnák wrote
> Mouse and keyboard events are usually captured by TRMorph and then
> converted into Roassal events, so check there.
>
> Peter
>
> On Sat, Feb 13, 2016 at 4:06 PM, Jan Blizničenko &lt;

> bliznjan@.cvut

> &gt;
> wrote:
>
>> Hello
>>
>> I would like to ask whether is there any way to directly find out if
>> specific key (shift in my case) is currently pressed. I am trying to
>> implement own multi-selection of elements drawn on Roassal canvas,
>> but I do not receive original MouseClick/Drag/whatever event with
>> shiftKeyPressed, but I receive only Roassal selection event without
>> this kind of information.
>> It would require lots of modifications on Roassal part to forward
>> such info (although it would be possible I suppose), so I am looking
>> for a way to bypass it.
>>
>> Any help is appreciated.
>>
>> Jan Blizničenko
>>
>>
>>
>> --
>> View this message in context:
>> http://forum.world.st/Getting-whether-specific-key-is-currently-press
>> ed-tp4877401.html Sent from the Pharo Smalltalk Users mailing list
>> archive at Nabble.com.
>>
>>





--
View this message in context: http://forum.world.st/Getting-whether-specific-key-is-currently-pressed-tp4877401p4877420.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.

Reply | Threaded
Open this post in threaded view
|

Re: Getting whether specific key is currently pressed

abergel
In reply to this post by Jan Blizničenko
Hi!

I do not have my laptop, so I cannot try. This is a field where Roassal is weak indeed. Let us know if you come with a solution.

What is your case? Having a selection box only when you press shift and drag and drop?

Once back from holidays, I will check how it is done in JavaFX.

Alexandre


> Le 13 févr. 2016 à 16:26, Jan Blizničenko <[hidden email]> a écrit :
>
> That's true, but I'm not sure that modifying TRMorph, TRMouseDragStart and
> TRMouseDragEnd is the right way to go here, so I'm interested in finding
> simpler solution if there is any.
>
> Jan
>
>
> Peter Uhnák wrote
>> Mouse and keyboard events are usually captured by TRMorph and then
>> converted into Roassal events, so check there.
>>
>> Peter
>>
>> On Sat, Feb 13, 2016 at 4:06 PM, Jan Blizničenko &lt;
>
>> bliznjan@.cvut
>
>> &gt;
>> wrote:
>>
>>> Hello
>>>
>>> I would like to ask whether is there any way to directly find out if
>>> specific key (shift in my case) is currently pressed. I am trying to
>>> implement own multi-selection of elements drawn on Roassal canvas, but I
>>> do
>>> not receive original MouseClick/Drag/whatever event with shiftKeyPressed,
>>> but I receive only Roassal selection event without this kind of
>>> information.
>>> It would require lots of modifications on Roassal part to forward such
>>> info
>>> (although it would be possible I suppose), so I am looking for a way to
>>> bypass it.
>>>
>>> Any help is appreciated.
>>>
>>> Jan Blizničenko
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://forum.world.st/Getting-whether-specific-key-is-currently-pressed-tp4877401.html
>>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/Getting-whether-specific-key-is-currently-pressed-tp4877401p4877420.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>

Reply | Threaded
Open this post in threaded view
|

Re: Getting whether specific key is currently pressed

Jan Blizničenko
Ok ok, you all have convinced me that this should be solved on Roassal part, not by calling such low level stuff like Sensor. I'll try to make and propose some changes in Roassal to forward such information.

And, Alex, my case is that when I just drag box around items on cavas (do marquee selection), all previously selected items are deselected and there is new selection made, but if I have shift pressed while doing it, these new selected items are ADDED to previous selection. I wanted it to be control instead of shift, but it seems control+left mouse button=right mouse button (don't know why, what a waste of ctrl, maybe for compatibility with some OS unknown to me (OS X?) or some old OS - like I've seen there are parts of Pharo where mouse buttons are called blue, yellow and red :) ).
I created my own subclass of RTAbstractElasticBoxInteraction for that job and this RTAbstractElasticBoxInteraction also needs to be modified to forward such "...KeyPressed" info. I didn't use RTSelectableView, because I do not want to select each Roassal element separatedly, but I need to select only our DynaCASE "elements" which may consist of multiple Roassal elements.

Jan

abergel wrote
Hi!

I do not have my laptop, so I cannot try. This is a field where Roassal is weak indeed. Let us know if you come with a solution.

What is your case? Having a selection box only when you press shift and drag and drop?

Once back from holidays, I will check how it is done in JavaFX.

Alexandre


> Le 13 févr. 2016 à 16:26, Jan Blizničenko <[hidden email]> a écrit :
>
> That's true, but I'm not sure that modifying TRMorph, TRMouseDragStart and
> TRMouseDragEnd is the right way to go here, so I'm interested in finding
> simpler solution if there is any.
>
> Jan
>
>
> Peter Uhnák wrote
>> Mouse and keyboard events are usually captured by TRMorph and then
>> converted into Roassal events, so check there.
>>
>> Peter
>>
>> On Sat, Feb 13, 2016 at 4:06 PM, Jan Blizničenko <
>
>> bliznjan@.cvut
>
>> >
>> wrote:
>>
>>> Hello
>>>
>>> I would like to ask whether is there any way to directly find out if
>>> specific key (shift in my case) is currently pressed. I am trying to
>>> implement own multi-selection of elements drawn on Roassal canvas, but I
>>> do
>>> not receive original MouseClick/Drag/whatever event with shiftKeyPressed,
>>> but I receive only Roassal selection event without this kind of
>>> information.
>>> It would require lots of modifications on Roassal part to forward such
>>> info
>>> (although it would be possible I suppose), so I am looking for a way to
>>> bypass it.
>>>
>>> Any help is appreciated.
>>>
>>> Jan Blizničenko
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://forum.world.st/Getting-whether-specific-key-is-currently-pressed-tp4877401.html
>>> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>
>
>
>
>
> --
> View this message in context: http://forum.world.st/Getting-whether-specific-key-is-currently-pressed-tp4877401p4877420.html
> Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
>