From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:48:25 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>Subcanvas2Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none selectionInList classNames <imports></imports> <category>Examples-Help</category> <attributes> <package>Subcanvas2-Example</package> </attributes> </class> <comment> Examples.Subcanvas2Example
Subcanvas2Example demonstrates using subcanvas to reuse an interface or an entire application.
</comment> <methods> Examples.Subcanvas2Example <category>actions</category>
add "When reusing just the interface, the #add action must be implemented locally." | entry newList | "Prompt for the name to add." entry := Dialog request: 'Add name'. "If the entry is blank, exit." entry isEmpty ifTrue: [^nil]. "Update the list." newList := SortedCollection withAll: self selectionInList list. newList add: entry. self selectionInList list: newList. "Highlight the newly added entry." self selectionInList selection: entry.
delete "When reusing just the interface, the #delete action must be implemented locally." | deletedElement newList continue | deletedElement := self selectionInList selection. "If nothing is selected, warn the user and exit." deletedElement isNil ifTrue: [^Dialog warn: 'Please select the entry to be deleted.']. "Confirm intent to delete." continue := Dialog confirm: 'Really delete this entry?'. continue ifFalse: [^nil]. "If intent confirmed, update the list." newList := SortedCollection withAll: self selectionInList list. newList remove: deletedElement. self selectionInList list: newList.
</methods> <methods> Examples.Subcanvas2Example <category>aspects</category>
classNames ^classNames
selectionInList ^selectionInList
</methods> <methods> Examples.Subcanvas2Example <category>initialize-release</category>
initialize "Reusing List2Example's interface only -- initialize the list holder." selectionInList := SelectionInList with: Core classNames. "Reusing List2Example application -- initialize the application instance." classNames := List2Example new. classNames list: Core classNames.
</methods> <methods> Examples.Subcanvas2Example class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#{UI.FullSpec} #window: #(#{UI.WindowSpec} #label: 'Subcanvas2Example' #min: #(#{Core.Point} 50 50 ) #bounds: #(#{Graphics.Rectangle} 800 600 1180 917 ) ) #component: #(#{UI.SpecCollection} #collection: #( #(#{UI.SubCanvasSpec} #layout: #(#{Graphics.LayoutFrame} 20 0 100 0 -20 0.5 0 1 ) #flags: 0 #majorKey: #{Examples.List2Example} #minorKey: #listSpec ) #(#{UI.SubCanvasSpec} #layout: #(#{Graphics.LayoutFrame} 20 0.5 100 0 -20 1 0 1 ) #flags: 0 #majorKey: #{Examples.List2Example} #minorKey: #listSpec #clientKey: #classNames ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.25 10 0 0.5 0 ) #label: 'Interface Reuse' ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.75 10 0 0.5 0 ) #label: 'Application Reuse' ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.25 36 0 0.5 0 ) #label: 'Local application supplies' #style: #small ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.25 50 0 0.5 0 ) #label: 'list holder and actions' #style: #small ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.75 36 0 0.5 0 ) #label: 'Local application supplies' #style: #small ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.75 50 0 0.5 0 ) #label: 'instance of List2Example' #style: #small ) #(#{UI.DividerSpec} #layout: #(#{Graphics.LayoutFrame} -50 0.25 33 0 50 0.25 37 0 ) ) #(#{UI.DividerSpec} #layout: #(#{Graphics.LayoutFrame} -50 0.75 33 0 50 0.75 37 0 ) ) #(#{UI.RegionSpec} #layout: #(#{Graphics.LayoutFrame} -2 0.5 5 0 2 0.5 -5 1 ) #colors: #(#{UI.LookPreferences} #setForegroundColor: #(#ColorValue #gray ) ) #lineWidth: 2 ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.75 64 0 0.5 0 ) #label: '(which supplies list holder' #style: #small ) #(#{UI.LabelSpec} #layout: #(#{UI.AlignmentOrigin} 0 0.75 78 0 0.5 0 ) #label: 'and actions)' #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>