[Q] What is the right context for this?
David Faught
dave_faught at yahoo.com
Fri Mar 21 19:01:16 UTC 2003
I am trying to redo NetModel so that it will work under Jacaranda.
Unfortunately there is a small snag. There is a menu that does global
things to the model that I can't figure out how to do.
There are a number of class methods in NetModel that do things for all
instances of that class in the current world. I have changed these to
refer to owner rather than world, and that seems to work for the most
part. But there is one menu that is a problem. Here is a shortened
version of the method:
doModelMenu
| aMenu answer thisWorld |
thisWorld := (self owner). "make a pretty simple assumption about the
world"
aMenu := SelectionMenu
labelList: #( 'Evaluate the model'
'Report on all circuits'
'Label all circuits with externalName'
'Unlabel all circuits'
'Erase the whole network' )
lines: #( 1 ) "optional"
selections: #( 'self evaluateModel. NetCircuit reportAllUtilinWorld:
thisWorld'
'NetReport new initialize: #listCircuits'
'NetCircuit allBeLabeled: #externalName inWorld: thisWorld'
'NetCircuit allRemoveAllLabelsinWorld: thisWorld'
'self eraseNetworkinWorld: thisWorld' ).
answer := aMenu startUpWithCaption: 'Pick One'.
Utilities evaluate: answer in: self to: nil.
The "Utilities evaluate:" fails because when the answer string is
evaluated, it has no clue of the instance variables or methods of the
object that is responding to this "doModelMenu" method. I think that
there are probably other things wrong with the way that this is put
together, like the way that I am trying to pass "thisWorld" to the
evaluated phrases. This all worked fine when I could just assume it
was in THE World instead of trying to specify what world things are in.
Any idea how I can straighten this out???
__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com
More information about the Squeak-dev
mailing list
|