Menu in Morh (Help)

Stephane Ducasse ducasse at iam.unibe.ch
Mon Jan 10 13:02:20 UTC 2000


Hi

I was thinking that to have a menu on a PluggableMorphText it was sufficient to
declare the selector of the method that would create the menu and to 
define the corresponding methods in the class like below.

MicroBrowser is a subclass of BorderedMorph


MicroBrowser>>openAsMorph
|window aTextMorph|
window _ (SystemWindow labelled: 'Turtle Micro Browser') model: self. 
aTextMorph _ (PluggableTextMorph 
                on: self 
                text: #methodDefinition 
                accept: #methodDefinition:
                readSelection: nil 
                menu:  #methodDefinitionMenu:). 

window addMorph: aTextMorph frame: (0.0 at 0.20 extent: 1 at 0.80).

and to define in the class 

MicroBrowser>>methodDefinitionMenu: aMenu


        ^ aMenu labels: 
'Blop'
        lines: #()
        selections: #(blop)


MicroBrowser>>blop

        Transcript show: 'blop' ; cr


Apparently I was wrong or made something wrong. 

I checked the class PluggableMorphText and saw that all the text
manipulation actions of the normal menu like accept, doit,...are defined there.

So I was wondering how I can define my own menu with my own action

I tried to have a menu invoking accept (replacing  blop by accept) 
but it failed too. 

Any suggestions?
Thanks in advance



Stephane DUCASSE (ducasse at iam.unibe.ch) http://www.iam.unibe.ch/~ducasse/
"if you knew today was your last day on earth, what would you do 
different? ... especially if, by doing something different, today 
might not be your last day on earth" Calvin&Hobbes

University of Bern, Institut fuer informatik and Mathematik
IAM-SCG, 10 neubruckstrasse, CH-3012 Bern, Switzerland.






More information about the Squeak-dev mailing list