From VisualWorks®, 7.6 of February 1, 2008 on February 1, 2008 at 12:47:14 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>FieldMenuExample</name> <environment>Examples</environment> <super>UI.ApplicationModel</super> <private>false</private> none field1 field2 field3 field4 <imports></imports> <category>Examples-Help</category> <attributes> <package>FieldMenu-Example</package> </attributes> </class> <comment> Examples.FieldMenuExample
This example class demonstrates techniques for customizing an input field's pop-up menu.
</comment> <methods> Examples.FieldMenuExample <category>menu messages</category>
capitalize "Capitalize the field's contents." self field1 value: (self field1 value collect: [ :ch | ch asUppercase]).
expandedMenu "Add a command to the default text-editing menu." | mb | mb := MenuBuilder new. mb add: 'capitalize'->#capitalize; line; addDefaultTextMenu. ^mb menu
newAccept Transcript show: self field3 value; cr.
newAcceptMenu "Redefine the 'accept' command by invoking a local alternate." | mb | mb := MenuBuilder new. mb addFindReplaceUndo; line; addCopyCutPaste; line; add: 'accept'->#newAccept; add: 'cancel'->#cancel. ^mb menu
noMenu ^[nil]
reducedMenu "Remove a command (#again) from the default text-editing menu." | mb | mb := MenuBuilder new. mb add: 'undo'->#undo; line; addCopyCutPaste; line; addAcceptCancel. ^mb menu
</methods> <methods> Examples.FieldMenuExample <category>aspects</category>
field1 "This method was generated by UIDefiner. The initialization provided below may have been preempted by an initialize method." ^field1 isNil ifTrue: [field1 := String new asValue] ifFalse: [field1]
field2 "This method was generated by UIDefiner. The initialization provided below may have been preempted by an initialize method." ^field2 isNil ifTrue: [field2 := String new asValue] ifFalse: [field2]
field3 "This method was generated by UIDefiner. The initialization provided below may have been preempted by an initialize method." ^field3 isNil ifTrue: [field3 := String new asValue] ifFalse: [field3]
field4 "This method was generated by UIDefiner. The initialization provided below may have been preempted by an initialize method." ^field4 isNil ifTrue: [field4 := String new asValue] ifFalse: [field4]
</methods> <methods> Examples.FieldMenuExample class <category>interface specs</category>
windowSpec "UIPainter new openOnClass: self andSelector: #windowSpec" <resource: #canvas> ^#(#FullSpec #window: #(#WindowSpec #label: 'FieldMenuExample' #min: #(#Point 257 175 ) #max: #(#Point 257 175 ) #bounds: #(#Rectangle 512 505 769 680 ) ) #component: #(#SpecCollection #collection: #( #(#InputFieldSpec #layout: #(#Rectangle 16 45 116 70 ) #name: #field1 #model: #field1 #menu: #expandedMenu ) #(#LabelSpec #layout: #(#Point 8 21 ) #label: 'Expanded menu' #style: #small ) #(#InputFieldSpec #layout: #(#Rectangle 16 135 116 160 ) #name: #field2 #model: #field2 #menu: #reducedMenu ) #(#LabelSpec #layout: #(#Point 11 111 ) #label: 'Reduced menu' #style: #small ) #(#InputFieldSpec #layout: #(#Rectangle 142 45 242 70 ) #name: #field3 #model: #field3 #menu: #newAcceptMenu ) #(#LabelSpec #layout: #(#Point 147 7 ) #label: 'New ''accept''' #style: #small ) #(#InputFieldSpec #layout: #(#Rectangle 142 135 242 160 ) #name: #field4 #model: #field4 #menu: #noMenu ) #(#LabelSpec #layout: #(#Point 159 111 ) #label: 'No menu' #style: #small ) #(#DividerSpec #layout: #(#Rectangle 128 -1 132 176 ) #orientation: #vertical ) #(#DividerSpec #layout: #(#Rectangle -1 93 257 97 ) ) #(#LabelSpec #layout: #(#Point 157 23 ) #label: 'command' #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>