From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:46:29 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>ButtonExample</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none outputMode showMinutes showHours showSeconds <imports></imports> <category>Examples-Help</category> <attributes> <package>Button-Example</package> </attributes> </class> <comment> Examples.ButtonExample
This example class demonstrates the use of action buttons, radio buttons and check boxes.
</comment> <methods> Examples.ButtonExample <category>initialize-release</category>
initialize super initialize. outputMode := #dialog asValue. showHours := true asValue. showMinutes := true asValue. showSeconds := true asValue.
</methods> <methods> Examples.ButtonExample <category>aspects</category>
outputMode ^outputMode
showHours ^showHours
showMinutes ^showMinutes
showSeconds ^showSeconds
</methods> <methods> Examples.ButtonExample <category>actions</category>
tellTime | t tString | t := Time now. tString := String new. "Assemble the time string based on the check boxes." self showHours value ifTrue: [tString := tString, t hours printString]. self showMinutes value ifTrue: [tString := tString, ':', t minutes printString, ':'] ifFalse: [tString := tString, '::']. self showSeconds value ifTrue: [tString := tString, t seconds printString]. "Send the time string to the output channel set by the radio buttons." self outputMode value == #transcript ifTrue: [Transcript show: tString; cr] ifFalse: [Dialog warn: tString]
</methods> <methods> Examples.ButtonExample class <category>resources</category>
hourglass ^Cursor wait asOpaqueImage
</methods> <methods> Examples.ButtonExample class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'ButtonExample' #min: #(#Point 50 50 ) #bounds: #(#Rectangle 496 458 698 575 ) ) #component: #(#SpecCollection #collection: #( #(#ActionButtonSpec #layout: #(#Rectangle 8 12 192 35 ) #model: #tellTime #label: 'Tell time' #style: #large #isDefault: false ) #(#RadioButtonSpec #layout: #(#Point 7 66 ) #model: #outputMode #label: 'Transcript' #style: #small #select: #transcript ) #(#RadioButtonSpec #layout: #(#Point 7 46 ) #model: #outputMode #label: 'Dialog' #style: #small #select: #dialog ) #(#CheckBoxSpec #layout: #(#LayoutOrigin 119 0 46 0 ) #model: #showHours #label: 'Hours' #style: #small ) #(#CheckBoxSpec #layout: #(#LayoutOrigin 119 0 67 0 ) #model: #showMinutes #label: 'Minutes' #style: #small ) #(#CheckBoxSpec #layout: #(#LayoutOrigin 119 0 88 0 ) #model: #showSeconds #label: 'Seconds' #style: #small ) ) ) )
</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>