[squeak-dev] dynamic GUI

Igor Stasenko siguctua at gmail.com
Wed Mar 4 00:42:37 UTC 2009


2009/3/4 Ralph Boland <rpboland at gmail.com>:
> I have a GUI  a section of which is a morph containing various
> GUI components, mainly buttons, radio buttons, and check boxes.
> Currently all GUI components  associated with the section morph
> are visible all the time even though only a subset of them
> are in use at any given time.
> The subset of components that are active at a given point is determined by a
> menu selection made by the user.
> The menu is attached to a button which is part of the section morph
> itself though I don't think that matters.
>
> How do I either:
>     a)  Disable the GUI components that are unused at a given point.
>     b)  (preferred) Redisplay the entire section morph.
>           I know how to determine which GUI components should be
>           selected for use when a new version of the morph is created
> (obviously).
>           What I don't know is how to remove the version of the
>           morph being displayed from the screen and replace it on the
>           screen with the new version which I just created.
>           Note that in general some of the section's GUI components
>           will remain active during the section morph replacement
>           and these components will maintain their values and effects.
>           Thus one possibility is to keep these components and just
>           assign them to the replacement section morph.  I don't know
>           what is involved in doing this or if it makes sense.
>
> Not that b) is much like using tabs to select pages with one of the
> differences being that the selection is made using a menu instead of tabs.
>

Suppose you have a container morph, which contents is entirely depends
on menu selection.
And you have say, a 3 sets of controls which you want to show
depending on current selection.
Create 3 morphs , add all submorphs to them, as appropriate.
Then , based on selection you can do:
container addMorph: (morphGroups at: x).

and when selection changes:
container removeAllSubMorphs (not sure if this method exists)
container addMorph: (morphGroups at: y).

where morphGroups is collection containing a morphs each holding
submorphs you need to display for given selection.

> Sorry for not voting.
> I tried a few minutes ago but got an error when I tried.
> I assume that I missed the deadline.
>
>
> Ralph Boland
>
>
>
>
> --
> When a woman becomes sexually aroused the necessary blood flows from her
> heart.
> When a man becomes sexually aroused, the necessary blood is removed from his
> brain.
>
>
>
>



-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list