Presenter initialization

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

Presenter initialization

Kasper Osterbye

I want to make a Spec Presenter which can show rendered pillar. I have the necessary code to transform a pillar string document into Text with fonts and stuff.

My problem is how to make the Presenter. To get moving I did not want to make a wysiwyg editor, but a simple two-mode thing. It either shows the rendered text or the pillar source.
When I looked at the Spec components it seems a reasonable approach to make it a subclass of SpTextPresenter, to get all the editing of the source for free.

Now after having made this subclass, PillarTextPreseanter, I realize it would be nice if I could tell the difference between rendering mode and editing mode. I thought it would be simple to use a slightly different background color for the editor in rendering mode.

And here is the problem:
 - If I override "initialize" to change the color (self color: MyColor), it has no effect 
 - If I override the "initializeWidgets" to change the color, it has no effect

Flopping through the implementation of "openWithSpec", I find that I can implement an "announceDisplayed" method, and if I set the color in that method it does indeed keep the color.

I have no idea how I should have found this out (except spending a Thursday morning on it), 
I am not sure it is the best solution. 
I have no idea why the other two methods do not work.

At times I must admit I am truely baffled by the complexity of it all.