My first morph

Bob.Cowdery at CGI-Europe.com Bob.Cowdery at CGI-Europe.com
Tue Nov 8 14:33:27 UTC 2005


 

Bert Freudenberg wrote:

 

> Look into class PianoKeyboardMorph, specifically #buildKeyboard. It  

> builds each key as a separate Morph and uses #on:send:to:withValue:  

> to wire events.

 

As far as I can make out this is a way to delegate sensor events to some
other object. They fire only if the object receiving the event does not
handle it. I tried it with mouseDown which my digit morph does not use and
it fires, with mouseOver which it does use it's handled so doesn't fire. I
could potentially use this to handle handleKeystroke so delegate the parent
to managing the mouse wheel. However, that gives me an error when I try it.
What I really want to do is something like raiseEvent from my code and then
'on: myEvent send: myHandler to: self'. Is there no equivalent to raiseEvent
in Morphic?

 

- Bob

 

 

- Bert -

 

Am 07.11.2005 um 22:18 schrieb Bob.Cowdery at CGI-Europe.com:

 

> Now I need to know how to do user defined events such

>

> that when a digit overflows or underflows the next digit in line  

> receives an

>

> event and can increment or decrement itself. The event can go  

> direct or

>

> probably more sensible to send it to the parent which is my top level

>

> display class not the alignment morph. Any hints appreciated.

>

>

> Chris Muller wrote:

>

>

> > I don't know whether I correctly understand what you are trying  

> to do, but one

>

> > suggestion would be to maintain a pure domain (the single number)  

> and just let

>

> > the UI display each digit..

>

>

> Ok, but the reason I have a separate Morph for each digit is that  

> it makes the mouse interaction a lot easier to do as I mouse over  

> each morph, highlight it and let it capture the wheel/keystrokes.  

> The parent will have the single domain number and can load the  

> digits initially and be informed when one changes. What I am after  

> is understanding the morphic event system or perhaps just an event  

> system. Not from the point of view of events generated from the  

> mouse, keyboard etc but in code when I decide there is something  

> another object might need to know about. At the moment I give the  

> object a block to execute which is really little more than a  

> callback to execute when a certain condition is met, so an empty  

> block evaluates to nil and nothing happens. This is the wrong way  

> to do it and I want to make it a pure event system. The sender of  

> the event should not be concerned who the receivers are or even if  

> there are any receivers.

>

>

> It's easy enough to code up a notifier class such that senders just  

> send their named events to a notifier instance and event listeners  

> register their interest in named events and then receive those  

> events. At least it's easy in languages I know, I am still  

> struggling a bit with the syntax and class library. I simply  

> thought that there must be a class that does that somewhere.

 


*** Confidentiality Notice *** Proprietary/Confidential
Information belonging to CGI Group Inc. and its affiliates
may be contained in this message. If you are not a recipient
indicated or intended in this message (or responsible for
delivery of this message to such person), or you think for
any reason that this message may have been addressed to you
in error, you may not use or copy or deliver this message
to anyone else.  In such case, you should destroy this
message and are asked to notify the sender by reply email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20051108/bd77ee5f/attachment.htm


More information about the Squeak-dev mailing list