[Cuis] Morph instance specific mouse and drag methods

Juan Vuletich juan at jvuletich.org
Wed Jan 15 09:03:43 CST 2014


Hi Ken,

On 1/13/2014 2:33 AM, Ken Dickey wrote:
> Hi Juan,
>
> Not sure you want this yet, but no ill effects and seems much simpler than the eToys handler code.
>
> I am posting to the group in case anyone wants to experiment with instance specific behaviors (done with "handlers" in Squeak).
>
> Try loading the change set then drag a morph from the World>  New Morph.. menu
>
> Open an inspector on the morph (Command-click menu: debug>  inspect morph) and add a mouse click behavior:
> "==================="
> self setProperty: #handlesMouseDown: toValue: #true.
> self setProperty: #mouseButton1Up:localPosition:
> 	toValue: [ :evt :posn | self color: self color negated ].
> "==================="
>
> Then click on the morph.
>
> Another fun thing to try is opening a BorderedRectMorph and setting property #allowsSubmorphDrag.  Embed a submorph and drag it out.
>
> Cheap tricks, but then everybody likes a bargan.  ;^)
>
> Cheers,
> -KenD

It is wonderful to see that Cuis enables thinking about and doing these 
kinds of things. Expanding the paradigm with clean and nice code!

I really like this kind of stuff. It would be great for Cuis to support 
End User experiments, and Instance Specific Behavior and State.

Maybe a hierarchy like this?:

Object
     ActiveModel
         InstanceSpecificBehaviorObject (#findABetterName)
             Morph

This would enable the instance specific stuff to be usable not only by 
morphs. It would also mean using the standard event system for Morphs. 
Not sure of the consequences, but sonds reasonable.

Does it make sense to allow CompiledMethods and not only blocks?

I'm not sure how, but I think the event system (#when:send:to: and 
friends) could be related to this. Maybe by using events we would avoid 
the need to add a special method that queries and evaluates the property.

Please keep experimenting, and telling us about it!

Cheers,
Juan Vuletich




More information about the Cuis mailing list