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."
2009/9/27 Tudor Girba <tudor.girba@gmail.com>:
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.
+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: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr] On Behalf Of Igor Stasenko Sent: Saturday, September 26, 2009 6:25 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] key pressed 2009/9/27 Tudor Girba <tudor.girba@gmail.com>:
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig. _______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
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: pharo-project-bounces@lists.gforge.inria.fr [mailto:pharo-project-bounces@lists.gforge.inria.fr ] On Behalf Of Igor Stasenko Sent: Saturday, September 26, 2009 6:25 PM To: Pharo-project@lists.gforge.inria.fr Subject: Re: [Pharo-project] key pressed
2009/9/27 Tudor Girba <tudor.girba@gmail.com>:
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- Best regards, Igor Stasenko AKA sig.
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
-- www.tudorgirba.com "One cannot do more than one can do."
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 <tudor.girba@gmail.com>:
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 Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
participants (4)
-
Hernán Morales Durand -
Igor Stasenko -
Schwab,Wilhelm K -
Tudor Girba