I have constructed a GUI (using Morphic) in which one submorph M needs to have its current submorphs replaced by another set of submorphs. In general there are several submorph sets exactly one of which is the set of submorphs of M at any one time and which one is in use is determined by user input (say clicking a button). The submorph sets are not necessarily disjoint.
Are there any examples showing how I do this? Or is it documented somewhere?
In my case at least M itself does not move within my main GUI.
Any help or pointers to where help can be found much appreciated.
Regards,
Ralph Boland
The way I've done it in the past is to just send #delete to the morph, and then add a new one in its place.
For instance, in this GUI:
http://www.huv.com/roboMagellan/MissionEditor.jpg
The morph at the bottom right, containing the navigator-specific information, is removed and replaced any time a new goal is selected, since each goal has a navigator, and specific navigators have different information associated with them that must be set...
Here's the method I call to do it:
addNavigatorPanelFor: aNavigator
navigatorMorph isNil ifFalse: [navigatorMorph delete].
navigatorMorph := AlignmentMorph new listDirection: #topToBottom; color: Color white; vResizing: #shrinkWrap; hResizing: #shrinkWrap; cellPositioning: #topLeft; yourself.
aNavigator notNil ifTrue: [aNavigator addNavigatorMorphsTo: navigatorMorph for: self].
window addMorph: navigatorMorph fullFrame: (LayoutFrame fractions: (0@0 corner: 1@1) offsets: (480@285 corner: -5@-5)).
So, basically, it deletes the old navigator morph, creates a new alignment morph in its place, and then asks the navigator to add its specific submorphs to it. Then it finally adds the new alignment morph to the window.
- Jon
On Fri, Jul 1, 2011 at 6:01 PM, Ralph Boland rpboland@gmail.com wrote:
I have constructed a GUI (using Morphic) in which one submorph M needs to have its current submorphs replaced by another set of submorphs. In general there are several submorph sets exactly one of which is the set of submorphs of M at any one time and which one is in use is determined by user input (say clicking a button). The submorph sets are not necessarily disjoint.
Are there any examples showing how I do this? Or is it documented somewhere?
In my case at least M itself does not move within my main GUI.
Any help or pointers to where help can be found much appreciated.
Regards,
Ralph Boland
squeak-dev@lists.squeakfoundation.org