From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:48:35 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>Table3Example</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none cellContents tableInterface sightingsTable <imports></imports> <category>Examples-Help</category> <attributes> <package>Table3-Example</package> </attributes> </class> <comment> Examples.Table3Example
Table3Example demonstrates using a Table widget to display data, including row and column labels. Instance Variables: tableInterface holding table data for the widget sightingsTable a SelectionInTable holding a TwoDList and a cell coordinates cellContents holds the contents of the entry field to put in the table
</comment> <methods> Examples.Table3Example <category>aspects</category>
cellContents ^cellContents
sightingsTable ^sightingsTable
tableInterface ^tableInterface
</methods> <methods> Examples.Table3Example <category>change messages</category>
changedCell | cellLocation | "Get the coordinates of the highlighted cell." cellLocation := self sightingsTable selectionIndex. "If a cell is selected, update its contents from the input field." cellLocation = Point zero ifFalse: [self sightingsTable table at: cellLocation put: self cellContents value]
</methods> <methods> Examples.Table3Example <category>initialize-release</category>
initialize | list | super initialize. "Create a collection of sightings data." list := TwoDList on: #('Vulcans' 188 173 192 'Romulans' 26 26 452) copy columns: 4 rows: 2. sightingsTable := SelectionInTable with: list. "Create a table interface and load it with the sightings." tableInterface := TableInterface new selectionInTable: sightingsTable. tableInterface columnWidths: #(100 40). cellContents := String new asValue. self cellContents onChangeSend: #changedCell to: self. tableInterface columnLabelsArray: #('Visiting Race' '1992' '1993' '1994'); rowLabelsArray: #(1 2); rowLabelsWidth: 20. tableInterface elementFormats: #(#left #right #right #right); columnLabelsFormats: #(#left #right #right #right); rowLabelsFormat: #right.
</methods> <methods> Examples.Table3Example class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'Table3Example' #bounds: #(#Rectangle 212 287 543 487 ) ) #component: #(#SpecCollection #collection: #( #(#TableViewSpec #layout: #(#Rectangle 22 4 288 156 ) #model: #tableInterface #showHGrid: true #showVGrid: true ) #(#InputFieldSpec #layout: #(#Rectangle 105 165 205 190 ) #model: #cellContents ) ) ) )
</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>