[squeak-dev] Maui questions

Douglas McPherson djm1329 at san.rr.com
Mon Jan 7 18:53:44 UTC 2013


Hi Chris,

I really like Maui for quickly generating UIs directly from domain objects. It feels fast and alive, and I think the views look good. There's a bit of a learning curve (which I'm on right now), but my sense is that it's well worth the time spent.

I've got a set of classes that represent the messages of a network protocol which can be serialized and sent over a socket, stored in byte arrays, etc. Essentially, the fields of the messages are stored in instance vars, and there are getter/setter accessors for each. I'm trying to build a Maui interface to allow me to select an arbitrary one of the messages (classes), fill in its values, then pick it up and drop it onto a Maui morph wrapping a socket connection, and thus send the message. 

I can explicitly (manually) create a MauiMorph for a specific message (instance of a class) in my protocol, drop the accessor selectors, and make them be getter/setters. I can fill in the fields of such a message and drop it onto the socket-wrapping MauiMorph. The message gets sent properly. I wish to build a more generic MauiMorph that allows me to select which message of the network protocol (class) to build, then have the accessors for that particular class automatically render in a panel, ready for filling in. I'm trying to avoid manually creating views for each of the message types. 

I tried to implement a 'picker' on a parameter holder but I can't figure out how to do it. Of course I can get an array of all the existing message subclasses and I can get that to render as a MauiCollectionMorph, but I can't see how to make this list be the choices of the picker. (I tried 'maui this morph' on the MauiCollectionMorph). I'm after functionality similar to the way the selectStrategy: parameter holder (in the MauiMessage settings panel) pops up a list of strategy classes and allows the user to select one of them. Also, I need to know how to populate the set of accessors particular to the selected message's fields. 

Another approach I tried (and couldn't make work) is to override the default behavior when a class is picked up from a browser and dropped onto the desktop. Instead of creating a MauiMorph on that class, I wished to create a MauiMorph on an instance of the class with all accessor MauiMessageMorphs already built. I tried overriding the 'maui' method on the class side, in which I send 'maui' to a new instance, programmatically add the accessors with 'addMessageNamed:' and return the result. Overriding 'maui' didn't work … is there an easy way to do this? (A side question: how can I programmatically add a method and have it be a getter/setter?).

I'll for sure have some more questions, but I'll start with these. 

Thanks!


More information about the Squeak-dev mailing list