[Q] "Entry" Widget

Ned Konz ned at bike-nomad.com
Sat Aug 30 14:39:26 UTC 2003


Martin Drautzburg wrote:

> What should I use to display a single short line of text that is
> editable and has a model. I tried TextMorph but I had to subclass it
> to teach it about its model. I tried PluggableTextMorph but for some
> reason it never came up. It seemed to be looping is some scrollbar
> methods and I don't want a scrollbar at all.

A PluggableTextMorph would be the thing to use. Just tell it you don't want a 
scrollbar. See the attached.

Note that you have to return true from your setter.


-------------- next part --------------
'From Squeak3.6beta of ''4 July 2003'' [latest update: #5387] on 30 August 2003 at 10:38:23 am'!
Object subclass: #MyLittleModel
	instanceVariableNames: 'theString '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'Demo'!

!MyLittleModel methodsFor: 'accessing' stamp: 'nk 8/30/2003 10:37'!
editField
	"(MyLittleModel new theString: 'whatever') editField openInHand"
	| ptm |
	ptm _ PluggableTextMorph on: self text: #theString  accept: #theString: .
	ptm hideScrollBarIndefinitely.
	^ptm.! !

!MyLittleModel methodsFor: 'accessing' stamp: 'nk 8/30/2003 10:34'!
theString
	^theString! !

!MyLittleModel methodsFor: 'accessing' stamp: 'nk 8/30/2003 10:37'!
theString: anObject
	theString := anObject.
	^true! !


More information about the Squeak-dev mailing list