From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:48:17 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>Slider1Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none currentYear destination tripRange <imports></imports> <category>Examples-Help</category> <attributes> <package>Slider1-Example</package> </attributes> </class> <comment> Examples.Slider1Example
Slider1Example demonstrates the use of a slider widget, both to change values and to indicate changed values.
</comment> <methods> Examples.Slider1Example <category>aspects</category>
currentYear ^currentYear
destination ^destination
tripRange ^tripRange
</methods> <methods> Examples.Slider1Example <category>actions</category>
engage "Start the time trip." | startingYear destinationYear direction | startingYear := self currentYear value. destinationYear := self destination value. destinationYear == startingYear ifTrue: [^Dialog warn: 'Please select a new destination.']. "Set the endpoints on the trip meter." self tripRange rangeStart: startingYear; rangeStop: destinationYear; grid: 1. "Reset the meter to the starting position." currentYear value: startingYear. "Set up a step value for the loop that follows (-1 = backward in time)." destinationYear > startingYear ifTrue: [direction := 1] ifFalse: [direction := -1]. "For each year of time travel, update the current year." startingYear to: destinationYear by: direction do: [ :yr | currentYear value: yr].
</methods> <methods> Examples.Slider1Example <category>initialize-release</category>
initialize "Destination" destination := Date today year asValue. "Current year" currentYear := Date today year asValue. "Trip meter" tripRange := RangeAdaptor on: currentYear start: 0 stop: 4000 grid: 1.
</methods> <methods> Examples.Slider1Example <category>interface opening</category>
postBuildWith: aBuilder "Disable the trip meter, making it read-only." (aBuilder componentAt: #tripRange) disable.
</methods> <methods> Examples.Slider1Example class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'Slider1Example' #min: #(#Point 533 366 ) #max: #(#Point 533 366 ) #bounds: #(#Rectangle 526 390 1059 756 ) ) #component: #(#SpecCollection #collection: #( #(#RegionSpec #layout: #(#LayoutFrame 0 0 -120 1 85 0 0 1 ) #lineWidth: 4 ) #(#RegionSpec #layout: #(#Rectangle 176 16 383 65 ) #isOpaque: true #colors: #(#LookPreferences #setBackgroundColor: #(#ColorValue #lightYellow ) ) #lineWidth: 2 #regionType: #ellipse ) #(#LabelSpec #layout: #(#Point 212 23 ) #colors: #(#LookPreferences #setForegroundColor: #(#ColorValue #black ) ) #label: 'Time Machine' #style: #large ) #(#SliderSpec #layout: #(#LayoutFrame 85 0 -100 1 0 1 0 1 ) #name: #tripRange #model: #tripRange #orientation: #horizontal ) #(#LabelSpec #layout: #(#Point 88 246 ) #label: 'Trip Meter' #style: #small ) #(#SliderSpec #layout: #(#Rectangle 7 97 527 148 ) #model: #destination #orientation: #horizontal #start: 0 #stop: 4000 #step: 10 ) #(#LabelSpec #layout: #(#Point 7 76 ) #label: 'Destination' #style: #small ) #(#InputFieldSpec #layout: #(#Rectangle 102 64 166 93 ) #model: #destination #style: #large #type: #number ) #(#LabelSpec #layout: #(#Point 5 147 ) #label: '0 A.D.' #style: #small ) #(#LabelSpec #layout: #(#Point 460 147 ) #label: '4000 A.D.' #style: #small ) #(#InputFieldSpec #layout: #(#Rectangle 464 234 528 263 ) #model: #currentYear #tabable: false #style: #large #isReadOnly: true #type: #number ) #(#LabelSpec #layout: #(#Point 366 245 ) #label: 'You are here' #style: #small ) #(#ActionButtonSpec #layout: #(#LayoutFrame 10 0 -75 1 74 0 0 0.942623 ) #model: #engage #label: 'Engage' ) #(#LabelSpec #layout: #(#Point 13 248 ) #label: 'Warp' #style: #small ) #(#LabelSpec #layout: #(#Point 13 266 ) #label: 'Engine' #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>