From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:47:46 pm (Dialog confirm: 'You are filing-in a Parcel source file!\\While this is possible it will not have\the same effect as loading the parcel.\None of the Parcel''s prerequisites will\be loaded and none of its load actions\will be performed.\\Are you sure you want to file-in?' withCRs) ifFalse: [self error: 'Parcel file-in abandoned. Choose terminate or close.'] <class> <name>MenuSwapExample</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none colors menuHolder <imports></imports> <category>Examples-Help</category> <attributes> <package>MenuSwap-Example</package> </attributes> </class> <comment> Examples.MenuSwapExample
MenuSwapExample demonstrates changing a menu while the application is running, by substituting a different menu.
</comment> <methods> Examples.MenuSwapExample <category>aspects</category>
colors ^colors
menuHolder ^menuHolder
</methods> <methods> Examples.MenuSwapExample <category>resources</category>
colorSelectedMenu | mb | mb := MenuBuilder new. mb add: 'Add Above' -> #unimplemented; line; add: 'Delete' -> #unimplemented; add: 'Delete All' -> #unimplemented. ^mb menu
nothingSelectedMenu | mb | mb := MenuBuilder new. mb add: 'Add At Bottom' -> #unimplemented; line; add: 'Delete All' -> #unimplemented. ^mb menu
</methods> <methods> Examples.MenuSwapExample <category>initialize-release</category>
initialize colors := SelectionInList with: ColorValue constantNames. colors selectionIndexHolder onChangeSend: #selectionChanged to: self. menuHolder := self nothingSelectedMenu asValue.
</methods> <methods> Examples.MenuSwapExample <category>change messages</category>
selectionChanged self colors selection isNil ifTrue: [self menuHolder value: self nothingSelectedMenu] ifFalse: [self menuHolder value: self colorSelectedMenu]
</methods> <methods> Examples.MenuSwapExample <category>actions</category>
unimplemented ^Dialog warn: ' The commands in this menu do nothing '
</methods> <methods> Examples.MenuSwapExample class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'MenuSwapExample' #min: #(#Point 212 212 ) #max: #(#Point 250 212 ) #bounds: #(#Rectangle 720 477 970 689 ) ) #component: #(#SpecCollection #collection: #( #(#SequenceViewSpec #layout: #(#LayoutFrame 14 0 10 0 -14 1 -50 1 ) #model: #colors #menu: #menuHolder ) #(#LabelSpec #layout: #(#AlignmentOrigin 0 0.5 -40 1 0.5 0 ) #label: 'When a list item is selected,' ) #(#LabelSpec #layout: #(#AlignmentOrigin 0 0.5 -25 1 0.5 0 ) #label: 'the pop-up menu changes' ) ) ) )
</methods> "Imported Classes:" self error: 'Attempting to file-in parcel imports. Choose terminate or close' <class> <name>ApplicationModel</name> <environment>UI</environment> <super>UI.Model</super> <private>false</private> none builder uiSession eventHandlers savedWindowInformation <imports></imports> <category>UIBuilder-Framework</category> <attributes> <package>UIBuilder-Framework</package> </attributes> </class>