From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:49:01 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>MenuSelectExample</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none career <imports></imports> <category>Examples-Help</category> <attributes> <package>MenuSelect-Example</package> </attributes> </class> <comment> Examples.MenuSelectExample
MenuSelectExample demonstrates one-of-n selection by a menu Instance Variables: career <ValueModel> model for career chosen
</comment> <methods> Examples.MenuSelectExample <category>actions</category>
beAccountant self career value: #accountant
beDoctor self career value: #doctor
beEngineer self career value: #engineer
beFarmer self career value: #farmer
bePoliceman self career value: #policeman
</methods> <methods> Examples.MenuSelectExample <category>aspects</category>
career ^career isNil ifTrue: [career := nil asValue] ifFalse: [career]
</methods> <methods> Examples.MenuSelectExample class <category>resources</category>
menuBar "Tools.MenuEditor new openOnClass: self andSelector: #menuBar" <resource: #menu> ^#(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: 'Careers' #submenu: #(#{UI.Menu} #( #(#{UI.MenuItem} #rawLabel: 'Farmer' #nameKey: #farmer #value: #beFarmer #indicationSelector: #career ) #(#{UI.MenuItem} #rawLabel: 'Policeman' #nameKey: #policeman #value: #bePoliceman #indicationSelector: #career ) #(#{UI.MenuItem} #rawLabel: 'Doctor' #nameKey: #doctor #value: #beDoctor #indicationSelector: #career ) #(#{UI.MenuItem} #rawLabel: 'Accountant' #nameKey: #accountant #value: #beAccountant #indicationSelector: #career ) #(#{UI.MenuItem} #rawLabel: 'Engineer' #nameKey: #engineer #value: #beEngineer #indicationSelector: #career ) ) #(5 ) nil ) ) ) #(1 ) nil ) decodeAsLiteralArray
</methods> <methods> Examples.MenuSelectExample class <category>interface specs</category>
windowSpec "Tools.UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: 'Menu select example' #min: #(#{Core.Point} 20 20 ) #max: #(#{Core.Point} 1600 1200 ) #bounds: #(#{Graphics.Rectangle} 800 600 1024 781 ) #flags: 4 #menu: #menuBar ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.RadioButtonSpec} #layout: #(#{Core.Point} 12 17 ) #name: #RadioButton1 #model: #career #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #beFarmer ) #label: 'Farmer' #select: #farmer ) #(#{UI.RadioButtonSpec} #layout: #(#{Core.Point} 12 43 ) #name: #RadioButton2 #model: #career #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #bePoliceman ) #label: 'Policeman' #select: #policeman ) #(#{UI.RadioButtonSpec} #layout: #(#{Core.Point} 12 69 ) #name: #RadioButton3 #model: #career #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #beDoctor ) #label: 'Doctor' #select: #doctor ) #(#{UI.RadioButtonSpec} #layout: #(#{Core.Point} 12 95 ) #name: #RadioButton4 #model: #career #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #beAccountant ) #label: 'Accountant' #select: #accountant ) #(#{UI.RadioButtonSpec} #layout: #(#{Core.Point} 12 121 ) #name: #RadioButton5 #model: #career #callbacksSpec: #(#{UI.UIEventCallbackSubSpec} #valueChangeSelector: #beEngineer ) #label: 'Engineer' #select: #engineer ) ) ) )
</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>