From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:48:43 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>Font1Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none labelFont <imports></imports> <category>Examples-Help</category> <attributes> <package>Font1-Example</package> </attributes> </class> <comment> Examples.Font1Example
Font1Example demonstrates changing a text widget's font dynamically.
</comment> <methods> Examples.Font1Example <category>change messages</category>
changedFont | widget newStyle oldLabel | widget := (self builder componentAt: #label) widget. newStyle := TextAttributes styleNamed: (self labelFont value). "Erase the existing label in case its font is larger than the new one." oldLabel := widget label text. widget labelString: ''. "Install the new font." widget textStyle: newStyle. "Reinstate the original label." widget labelString: oldLabel.
</methods> <methods> Examples.Font1Example <category>initialize-release</category>
initialize labelFont := #default asValue. labelFont onChangeSend: #changedFont to: self.
</methods> <methods> Examples.Font1Example <category>aspects</category>
labelFont ^labelFont
</methods> <methods> Examples.Font1Example class <category>resources</category>
fontMenu | mb styles | styles := TextAttributes styles asSortedCollection. mb := MenuBuilder new. styles do: [:style | | label | (label := style asString) at: 1 put: label first asUppercase. label = 'SystemDefault' ifTrue: [label := 'System']. mb add: label->style]. ^mb menuHolder
</methods> <methods> Examples.Font1Example class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'Font1Example' #min: #(#Point 167 115 ) #max: #(#Point 167 115 ) #bounds: #(#Rectangle 467 321 634 436 ) ) #component: #(#SpecCollection #collection: #( #(#LabelSpec #layout: #(#Point 89 68 ) #name: #label #label: 'Label' ) #(#MenuButtonSpec #layout: #(#LayoutFrame 8 0 9 0 -8 1 34 0 ) #model: #labelFont #menu: #fontMenu ) ) ) )
</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>