[Newbie] - Building a Morphic UI - more

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Newbie] - Building a Morphic UI - more

Dugald Wilson
Further to my previous newbie submission of a few days ago...

[Previously on this thread... I have an graphical engineering
application in VisualWorks ST that I am trying to port to Squeak for my
self edification and training.]

I have managed to build the basic UI except for the important bit - the
graphics. I have a few buttons with callbacks, a slider and some radio
buttons.  It has been slow and extremely frustrating, going step by
step, feeling my way in the darkness of a lack of documentation.  Using
LayouPolicies and LayoutFrames I have managed to create a UI that looks
OK-ish, and stretches and scales itself how I want.  There are still
look and feel issues I don't like, such as the title bar and its
constant regeneration that causes any changes of mine ot be lost.  The
resultant code is very mucky but will be refactored when the time is right.

I have also managed to suppress the haloes for UI components by
modifying something in Morph.  Woo-hoo!

Before I get onto the "big one"... Although radio buttons are
ThreePhaseButtonMorphs, how do you group them so that switching one on
turns the others off, unless you manage it by hand (again)?  I have 2
different radio button groups.  Sounds like there is scope for a
standard widget - a RadioButtonGroup.  As it is, radio buttons have
extremely weird behaviour as one has to drag the cursor off them to turn
them off.

The BIG ONE... Below the SystemWindow what Morph hierarchy do I
construct in order to be able to draw my model in a View (or is it Form)
that I can pan around with horizontal and vertical scroll bars and
scale.  I also need to be able to pick objects on screen and move them
around as well as to be able to locate points in the model space.  I
need some form of mouse controller.  I can't see where mouse
down/up/move events get managed.  I have resorted to looking at the
Purple Book as well as Mark Guzdial's, but neither show an example
similar to what I would expect or want.  Where does the Form come in?
Is this the GraphicsContext in VW?

Currently I have a subclass of StandardSystemView which accesses my
model.  This needs to be displayed on a Form, I presume.  But I think,
and possibly misunderstand, that I am to be creating an ImageMorph on a
Form in the SystemWindow, but this should dynamically change as I move
bits of my model around by cursor events.  When does the displayOn:
message get sent?

To help in my BIG ISSUE, a component hierarchy diagram might be useful
to show the nesting of UI components in the SystemWindow.  And how the
mouse/cursor interaction is managed would be useful too.

<gripe>

Following from one contributer's suggestion that I can modify anything
in Squeak I wish.  I do not think the basic Squeak UI widget set has
sufficient functionality nor consistency with other UI systems for one
to be able to use them without serious modification.  And I would rather
spend my time doing the _useful_ bits of engineering rather than wasting
a disproportionate amount of time scrabbling around at the bottom of the
system in order to create a usable UI.  BTW - The ProgrammingMorphs
package does not load into Squeak 3.8.

Over the last few years, I have had to work building UIs in different
systems, and I am developing an extreme aversion to them!  Whichever
system you use, it takes far too many steps to get information from the
user into the _real_ program that does the work.

Sorry this appears to be a long gripe, but if I can't see reasonable
progress in my short supply of spare time, I'll just give up and go
juggling instead!

</gripe>

--
Dugald

Reply | Threaded
Open this post in threaded view
|

Re: [Newbie] - Building a Morphic UI - more

Elod Kironsky
Hi Dugald!

> Before I get onto the "big one"... Although radio buttons are
> ThreePhaseButtonMorphs, how do you group them so that switching one on
> turns the others off, unless you manage it by hand (again)?  I have 2
> different radio button groups.  Sounds like there is scope for a
> standard widget - a RadioButtonGroup.  As it is, radio buttons have
> extremely weird behaviour as one has to drag the cursor off them to
> turn them off.
>
What is the problem with a RadioButtonGroup? Other system also manage it
in a similar way, the only difference is, you do not have to generate a
different class, but something must be in the background and manage
those buttons.

> The BIG ONE... Below the SystemWindow what Morph hierarchy do I
> construct in order to be able to draw my model in a View (or is it
> Form) that I can pan around with horizontal and vertical scroll bars
> and scale.  I also need to be able to pick objects on screen and move
> them around as well as to be able to locate points in the model
> space.  I need some form of mouse controller.  I can't see where mouse
> down/up/move events get managed.  I have resorted to looking at the
> Purple Book as well as Mark Guzdial's, but neither show an example
> similar to what I would expect or want.  Where does the Form come in?
> Is this the GraphicsContext in VW?
>
You will be surprised how easy this is. Just define in your class/form a
method handlesMouseDown: evt and return true. Then define the method
mouseDown: evt, what is actually the event handler of your morph. Try to
find those methods in method finder and have a look at other classes.

> Currently I have a subclass of StandardSystemView which accesses my
> model.  This needs to be displayed on a Form, I presume.  But I think,
> and possibly misunderstand, that I am to be creating an ImageMorph on
> a Form in the SystemWindow, but this should dynamically change as I
> move bits of my model around by cursor events.  When does the
> displayOn: message get sent?
>
> To help in my BIG ISSUE, a component hierarchy diagram might be useful
> to show the nesting of UI components in the SystemWindow.  And how the
> mouse/cursor interaction is managed would be useful too.
>
I strongly advice you to have a look at the Jacaranda package. It is an
UML like diagram editor. When I started to work with morphs it was my
starting point.

>
> Following from one contributer's suggestion that I can modify anything
> in Squeak I wish.  I do not think the basic Squeak UI widget set has
> sufficient functionality nor consistency with other UI systems for one
> to be able to use them without serious modification.  And I would
> rather spend my time doing the _useful_ bits of engineering rather
> than wasting a disproportionate amount of time scrabbling around at
> the bottom of the system in order to create a usable UI.  BTW - The
> ProgrammingMorphs package does not load into Squeak 3.8.
>
I think one of the greatest advantages of Morphic is the great number of
widgets supplied with it. You must realize, that this system is/was not
intended to provide a repository of widgets for professional or industry
use. The main goal of that widgets is to teach by example and to provide
a base that you can use to build your own classes. ProgrammingMorphs
package does load into Squeak 3.8. You probably upgraded the SquakMap
Loader and older packages do not work with the newer version. Try to
download the package manually from SqueakMap and load into Squeak.

> Over the last few years, I have had to work building UIs in different
> systems, and I am developing an extreme aversion to them!  Whichever
> system you use, it takes far too many steps to get information from
> the user into the _real_ program that does the work.
>
In this case I can only advice you to stop with UIs :-) BTW: did you try
wxSqueak?

Elod