|
Re: PluggableTextMorph: msg#00258lang.smalltalk.squeak.beginners
Le Sunday 27 August 2006 18:02, Keith McKay a écrit : > Hi > > I'm looking for some advice on setting the margins in a > PluggableTextMorph(PTM) programaticaly. It can be done easily once the PTM > is open in the World by drilling down to the TextMorph and invoking its menu > using the halos, but I would like the option of initialising them, or adding > as an item to a menu of the PTM. > > Am I missing something obvious? Should I just use a TextMorph instead? > Hints rather than solutions would be preferable. I see two solutions : one is to make two new classes : PluggableTextMorphWithMargins that is a subclass of PluggableTextMorph TextMorphForEditViewWithMargins that is a subclass of TextMorphForEditView and one method in each new subclass : PluggableTextMorphWithMargins>>textMorphClass "Answer the class used to create the receiver's textMorph" ^ TextMorphForEditViewWithMargins TextMorphForEditViewWithMargins>>initialize super initialize. self margins: 10@10 And now you can use PluggableTextMorphWithMargins instead of PluggableTextMorph. another solution is two send 'ptm textMorph margins: 10@10' to your PluggableTextMorph instance (ptm) from PluggableTextMorph instance owner (in your GUI class initialize instance method for example). I think this is a better way ('one particular need, one subclass' is often not a good scheme...) alain > > Thanks > > Keith > Hamilton, Scotland >
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: PluggableTextMorph, Alain Plantec |
|---|---|
| Next by Date: | Special invitation: Squeak Meeting 28th Okt Bern/Switzerland, Marcus Denker |
| Previous by Thread: | Re: PluggableTextMorph, Alain Plantec |
| Next by Thread: | Metaclass hierarchy - Explanation - Part 1, Damien Cassou |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |