I am trying to construct a small GUI interface to add text items to a list of text items. I found that TextMorph seemed to have the capabilities I wanted in that it could accept focus and give an insertion cursor and you can get and set the characters. If I do 'TextMorph borderedPrototype openInHand' I get that 'nice' behaviour in a free floating morph. If I make an AlignmentMorph (to contain it and the list) and drop the above TexstMorph it continues to work fine (you can type in it). If I programatically construct the AlignmentMorph and insert a new TextMorph and then open the containing Alignment, like: |a| a := AlignmentMorph newRow; extent: 200@200. a addMorph: TextMorph borderedPrototype. a openInHand then the TextMorph will not 'take' an insertion cursor and seems 'dead'/'deaf' to the mouse. what am I doing wrong? should I use something other than TextMorph? am I constructing the Alignment ok? does anyone have a good example of something similar I can look at to gain understanding regards, nicholas |
On 2/9/06, Nicholas Bennett <[hidden email]> wrote:
> > I am trying to construct a small GUI interface to add text items to a list > of text items. > > I found that TextMorph seemed to have the capabilities I wanted in that it > could accept focus and give an insertion cursor and you can get and set the > characters. > > If I do 'TextMorph borderedPrototype openInHand' I get that 'nice' behaviour > in a free floating morph. > > If I make an AlignmentMorph (to contain it and the list) and drop the above > TexstMorph it continues to work fine (you can type in it). > > If I programatically construct the AlignmentMorph and insert a new TextMorph > and then open the containing Alignment, like: > > |a| > a := AlignmentMorph newRow; extent: 200@200. > a addMorph: TextMorph borderedPrototype. > a openInHand Removing the ; after newRow, I get what you do. > then the TextMorph will not 'take' an insertion cursor and seems > 'dead'/'deaf' to the mouse. So I hacked it a little... |a| a := AlignmentMorph newRow extent: 200@200. a addMorph: (TextMorph borderedPrototype isPartsDonor: false; yourself). a openInHand ...thus undoing one of the chains of events (markAsPartsDonor) started by borderedPrototype. Morph>>openInHand undoes it too, which explains why you can type into it. Here's TextMorph's implementation of handlesMouseDown: ... handlesMouseDown: evt self isPartsDonor ifTrue: [^ false]. ^ self innerBounds containsPoint: evt cursorPoint ...a little more light on the subject. Hope this helps, Steve -- How wonderful it is that nobody need wait a single moment before starting to improve the world. -- Anne Frank Paradise is exactly where you are right now...only much, much better. -- Laurie Anderson |
thanks - that sounds like exactly what I needed to know! >From: Steven Elkins <[hidden email]> >Reply-To: The general-purpose Squeak developers >list<[hidden email]> >To: The general-purpose Squeak developers >list<[hidden email]> >Subject: Re: how to??? TextMorph and Alignment >Date: Thu, 9 Feb 2006 22:05:11 -0500 > >On 2/9/06, Nicholas Bennett <[hidden email]> wrote: > > > > I am trying to construct a small GUI interface to add text items to a >list > > of text items. > > > > I found that TextMorph seemed to have the capabilities I wanted in that >it > > could accept focus and give an insertion cursor and you can get and set >the > > characters. > > > > If I do 'TextMorph borderedPrototype openInHand' I get that 'nice' >behaviour > > in a free floating morph. > > > > If I make an AlignmentMorph (to contain it and the list) and drop the >above > > TexstMorph it continues to work fine (you can type in it). > > > > If I programatically construct the AlignmentMorph and insert a new >TextMorph > > and then open the containing Alignment, like: > > > > |a| > > a := AlignmentMorph newRow; extent: 200@200. > > a addMorph: TextMorph borderedPrototype. > > a openInHand > >Removing the ; after newRow, I get what you do. > > > then the TextMorph will not 'take' an insertion cursor and seems > > 'dead'/'deaf' to the mouse. > >So I hacked it a little... > >|a| >a := AlignmentMorph newRow extent: 200@200. >a addMorph: (TextMorph borderedPrototype isPartsDonor: false; yourself). >a openInHand > >...thus undoing one of the chains of events (markAsPartsDonor) started >by borderedPrototype. Morph>>openInHand undoes it too, which explains >why you can type into it. Here's TextMorph's implementation of >handlesMouseDown: ... > >handlesMouseDown: evt > self isPartsDonor ifTrue: [^ false]. > ^ self innerBounds containsPoint: evt cursorPoint > >...a little more light on the subject. > >Hope this helps, >Steve > >-- >How wonderful it is that nobody need wait a single moment >before starting to improve the world. -- Anne Frank >Paradise is exactly where you are >right now...only much, much better. -- Laurie Anderson > |
Free forum by Nabble | Edit this page |