I have been struggling for a long time with getting keystrokes into my application. First I read that I must create a keyboardProcessor instance variable in my custom controller, and create access methods for that variable, but I must not initiate the instance variable: that will be handled by the framework. Then I read that that arrangement is deprecated. I tried investigating how Tools.FileBrowser openOnFileNamed: 'tempfile' does its work, but it turns out that it operates in an entirely different way. Surely there is a small set of steps. All I want to do is get the keypresses delivered to a suitable method, something like View>>keyPressed: or Controller>>keyPressed: The framework can't be that hard. Is there a little application somewhere, called "Noisy," that just exercises all the features and logs what it's doing? Regards,
Rick
-- I insist on rapport! _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Dear Rick,
(please excuse if I'm asking the obvious / missing the point.) MagicKeys does/does not address this? Yours faithfully Niall Ross >I have been struggling for a long time with getting keystrokes into my >application. First I read that I must create a keyboardProcessor instance >variable in my custom controller, and create access methods for that >variable, but I must not initiate the instance variable: that will be >handled by the framework. Then I read that that arrangement is deprecated. > >I tried investigating how Tools.FileBrowser openOnFileNamed: 'tempfile' does >its work, but it turns out that it operates in an entirely different way. > >Surely there is a small set of steps. All I want to do is get the keypresses >delivered to a suitable method, something like View>>keyPressed: or >Controller>>keyPressed: The framework can't be that hard. > >Is there a little application somewhere, called "Noisy," that just exercises >all the features and logs what it's doing? > > Regards, > > Rick > > > >------------------------------------------------------------------------ > >_______________________________________________ >vwnc mailing list >[hidden email] >http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Rick Hedin
No, I don't think it should be that hard. I would think the method
you're looking for is something like
Controller>>keyPressedEvent:, perhaps in conjunction with
keyReleasedEvent:, depending what level of detail you want. In fact,
that's pretty low-level, and typically people want things like
shortcuts that you could define more easily in the UI builder (for
menus, buttons, etc), or in the
ParagraphEditor>>dispatchTable, if you're inside a text
editor. But it depends what you're trying to do.
--
[hidden email] [hidden email] http://www.cincomsmalltalk.com _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Rick Hedin
On Mar 22, 2011, at 5:42 AM, Rick Hedin wrote:
Rick, what version of VisualWorks are you using? I'm going a bit from memory here, I'm hoping this is right, but might make an error, hope not. To do keyboard in pre 7.8, your controller needs to a) have a keyPressedEvent: b) have the related view added as a keyboardConsumer in the KeyboardProcessor object held by the Window's keyboardProcessor instance variable c) focus your controller with yourWindow keyboardProcessor setActive: yourController. It has been common to store a reference to the keyboardProcessor in your controller with a setter/accessor. But you never needed to, and we are now discouraging it. You can get at the keyboardProcessor by walking the parent (container) tree up to the window. Without (b) and (c) though, keypress events will never find there way to your controller. There may be some other methods your controller needs to implement once it becomes a keyboard savvy one. You need to make sure that YourController>>release method removes itself from the keyboardConsumers list as well (self keyboardProcessor removeKeyboardConsumer: self). In 7.8, (b) is gone. The keyboardConsumers is inferred from the view tree in 7.8, so you don't have to register them and unregister them. And while you can still send setActive: in 7.8, it is deprecated, and instead you should send focusedView: with the view as the argument (rather than the event handler (controller)). -- Travis Griggs Objologist "I did not have time to write you a short program, so I wrote you a long one instead." _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Maybe I am missing something, but all I have to do this is in the
postBuildWith:
aBuilder keyboardProcessor keyboardHook: [:ev :ctrl | self keyStroke: ev ctrl: ctrl]. and then I have a method "keyStroke:ctrl:" This has worked for many versions of VW (up to 7.7.1 anyway) On Mar 22/11 2:28 PM, Travis Griggs wrote:
-- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 <a class="moz-txt-link-freetext" href="sip:dennis@CherniakSoftware.com">sip:dennis@... Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Alan Knight-2
Hi, Alan.
I just put a "Probe - Simple Message Trace" on those two methods, typed some keys in my application, and got nothing. Something is not connected further up (down?) the chain.
Regards,
Rick
On Tue, Mar 22, 2011 at 12:34 PM, Alan Knight <[hidden email]> wrote:
-- I insist on rapport! _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Travis Griggs-4
I should have sent this to the whole newsgroup.
---------- Forwarded message ---------- From: Rick Hedin <[hidden email]> Date: Thu, Mar 24, 2011 at 5:48 AM Subject: Re: [vwnc] Get keypress events To: Travis Griggs <[hidden email]> Hello Travis.
Other projects are competing for time, but last night I got a chance to try to apply these insights. I've interspersed reactions below.
On Tue, Mar 22, 2011 at 1:28 PM, Travis Griggs <[hidden email]> wrote:
I'm using 7.7.1.
I wasn't sure where to put this. Following a suggestion in the NoPolling.pdf document from Cincom, I put it in AbeController>>redButtonPressedEvent. But it never went there.
Adding is done with
self keyboardProcessor removeKeyboardReceiver: self
and removing is done with
self keyboardProcessor addKeyboardReceiver
?
I don't find a controller release method. I'm not sure where is a good place to remove myself from the list of receivers.
I'm sure what you're saying is correct, but I haven't been able to connect the final link.
Surely there's a piece of code somewhere that uses the framework to deliver keystrokes to the controller or the view. If I had a working example, I could puzzle it out.
(The UI.TextEditorController and -View cheat. : ) I traced those, and they deliver a keystroke to the controller or a view if it is not a "normal" character. If it is a carriage-return or something like that.)
Regards,
Rick -- I insist on rapport! _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Rick Hedin
Anyone knows where I could find the following (I know it's old stuff!):
1) VWNC 3i 2) VWNC 5i 3) Backup of Manchester Smalltalk Archive 4) Backup of UIUC Smalltalk Archive And if I member correctly, wasn't one of those 2 archives included with old versions of VW (but I don't remember which one) ? tia _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
1 & 2) are owned by Cincom, so you’d have to ask them. 3 & 4) http://ftp.gwdg.de/pub/languages/smalltalk/st.cs.uiuc.edu/ don’t know how out of date it is. Seems to also contain Manchester archive This may or may not be newer: http://web.archive.org/web/20030120195655/http://wuarchive.wustl.edu/languages/smalltalk/ You can try different dates here: http://web.archive.org/*/http://wuarchive.wustl.edu/languages/smalltalk/ I don’t remember 3&4 being included with VW/OW, but maybe I’m too young (only around since ObjectWorks 4.1) or too old (i.e. my memory is failing) Steve From: [hidden email] [mailto:[hidden email]] On Behalf Of Benoit St-Jean Anyone knows where I could find the following (I know it's old stuff!): _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |