key pressed

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

key pressed

Tudor Girba
Hi,

How can I check whether a certain key is pressed (for example, a  
modifier like Shift)?

Cheers,
Doru


--
www.tudorgirba.com

"If you interrupt the barber while he is cutting your hair, you will  
end up with a messy haircut."


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: key pressed

Igor Stasenko
2009/9/27 Tudor Girba <[hidden email]>:
> Hi,
>
> How can I check whether a certain key is pressed (for example, a
> modifier like Shift)?
>
Depends on context. In Morphic, just take an event (mouse event or
keyboard event) and
send #shiftPressed, or #controlKeyPressed, or whatever.

Another way is to ask the Sensor for same things, but i wouldn't do
that, because
to my opinion this is the wrong way, because Sensor is low-level
object, which should be
hidden from the eyes of developer, and normally, if you need to use
it, it means that you doing something wrong :)


> Cheers,
> Doru
>
>
> --
> www.tudorgirba.com
>
> "If you interrupt the barber while he is cutting your hair, you will
> end up with a messy haircut."
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: key pressed

hernanmd
In reply to this post by Tudor Girba
Hi Tudor,
               You can check the implementation of
FixedIPluggableTextMorph>>keyStroke: and HandMorph STicky protocol
category in my recent STicky project,
http://www.squeaksource.com/STicky.html
Cheers,

HernĂ¡n

2009/9/26 Tudor Girba <[hidden email]>:

> Hi,
>
> How can I check whether a certain key is pressed (for example, a
> modifier like Shift)?
>
> Cheers,
> Doru
>
>
> --
> www.tudorgirba.com
>
> "If you interrupt the barber while he is cutting your hair, you will
> end up with a messy haircut."
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: key pressed

Schwab,Wilhelm K
In reply to this post by Igor Stasenko
+1 to Sig's comments.  Another problem with looking at the current state vs. state from an event is that the current state is just that, and often differs (covertly and frustratingly) from the user's intentions.  Such problems often arise with mouse cursor positions.

Bill


-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Igor Stasenko
Sent: Saturday, September 26, 2009 6:25 PM
To: [hidden email]
Subject: Re: [Pharo-project] key pressed

2009/9/27 Tudor Girba <[hidden email]>:
> Hi,
>
> How can I check whether a certain key is pressed (for example, a
> modifier like Shift)?
>
Depends on context. In Morphic, just take an event (mouse event or keyboard event) and send #shiftPressed, or #controlKeyPressed, or whatever.

Another way is to ask the Sensor for same things, but i wouldn't do that, because to my opinion this is the wrong way, because Sensor is low-level object, which should be hidden from the eyes of developer, and normally, if you need to use it, it means that you doing something wrong :)


> Cheers,
> Doru
>
>
> --
> www.tudorgirba.com
>
> "If you interrupt the barber while he is cutting your hair, you will
> end up with a messy haircut."
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: key pressed

Tudor Girba
Thanks for the replies.

Actually, I am in the code of selectedItem: of a list and I would like  
to add to the current selection if Shift is pressed. The problem is  
that I do not have access there at the event.

Cheers,
Doru

On 27 Sep 2009, at 03:14, Schwab,Wilhelm K wrote:

> +1 to Sig's comments.  Another problem with looking at the current  
> state vs. state from an event is that the current state is just  
> that, and often differs (covertly and frustratingly) from the user's  
> intentions.  Such problems often arise with mouse cursor positions.
>
> Bill
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]
> ] On Behalf Of Igor Stasenko
> Sent: Saturday, September 26, 2009 6:25 PM
> To: [hidden email]
> Subject: Re: [Pharo-project] key pressed
>
> 2009/9/27 Tudor Girba <[hidden email]>:
>> Hi,
>>
>> How can I check whether a certain key is pressed (for example, a
>> modifier like Shift)?
>>
> Depends on context. In Morphic, just take an event (mouse event or  
> keyboard event) and send #shiftPressed, or #controlKeyPressed, or  
> whatever.
>
> Another way is to ask the Sensor for same things, but i wouldn't do  
> that, because to my opinion this is the wrong way, because Sensor is  
> low-level object, which should be hidden from the eyes of developer,  
> and normally, if you need to use it, it means that you doing  
> something wrong :)
>
>
>> Cheers,
>> Doru
>>
>>
>> --
>> www.tudorgirba.com
>>
>> "If you interrupt the barber while he is cutting your hair, you will
>> end up with a messy haircut."
>>
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Best regards,
> Igor Stasenko AKA sig.
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

--
www.tudorgirba.com

"One cannot do more than one can do."




_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project