Hi,
is it possible to embed (any) editable text field inside Roassal? I managed to add the editor morph inside Trachel's athens canvas, however there is no way I can access it... my guess is that TRMorph takes all the events, or drawing the morph on the canvas destroys something. I tried it with PluggableTextFieldMorph (shows the border of the edit field, but no text), and TxTextEditorMorph (shows text). Is there any way around this? Adding the morph inside AthensWrapMorph works correctly, so my guess is that TRMorph must be doing something... perhaps I should also add it as a submorph of TRMorph somehow? My testing code follows: ------------------------------------------------ "opening the canvas and adding custom shape" trCanvas := TRCanvas new. text := SBEditableTextShape new. trCanvas addShape: text. trCanvas open. ------------------------------------------------ ------------------------------------------------ "content of SBEditableTextShape - same as the attachement" 'From Pharo4.0 of 18 March 2013 [Latest update: #40470] on 1 February 2015 at 10:13:04.069249 pm'! TRShape subclass: #SBEditableTextShape instanceVariableNames: 'txMorph txModel wrapMorph textMorph' classVariableNames: '' poolDictionaries: '' category: '_Sandbox'! !SBEditableTextShape methodsFor: 'drawing' stamp: 'PeterUhnak 2/1/2015 22:10'! drawOn: aCanvas " aCanvas fullDrawMorph: textMorph." aCanvas fullDrawMorph: txMorph.! ! !SBEditableTextShape methodsFor: 'initialization' stamp: 'PeterUhnak 2/1/2015 22:07'! initialize | string | super initialize. string := 'quick brown fox jumps over the lazy dog'. txModel := string asTxModel. txMorph := TxTextEditorMorph text: txModel. txMorph extent: 150 @ 50. textMorph := PluggableTextFieldMorph new. textMorph extent: 150 @ 50. textMorph setText: string. textMorph ghostText: 'ghost text'.! ! ------------------------------------------------ Any help is appreciated, Peter _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev SBEditableTextShape.st (1K) Download Attachment |
Hi Peter!
We will have a look at your code. Cheers, Alexandre > Le 1 févr. 2015 à 18:21, Peter Uhnák <[hidden email]> a écrit : > > Hi, > > is it possible to embed (any) editable text field inside Roassal? > > I managed to add the editor morph inside Trachel's athens canvas, however there is no way I can access it... my guess is that TRMorph takes all the events, or drawing the morph on the canvas destroys something. > > I tried it with PluggableTextFieldMorph (shows the border of the edit field, but no text), and TxTextEditorMorph (shows text). > > Is there any way around this? Adding the morph inside AthensWrapMorph works correctly, so my guess is that TRMorph must be doing something... perhaps I should also add it as a submorph of TRMorph somehow? > > My testing code follows: > > ------------------------------------------------ > "opening the canvas and adding custom shape" > trCanvas := TRCanvas new. > > text := SBEditableTextShape new. > trCanvas addShape: text. > > trCanvas open. > ------------------------------------------------ > > ------------------------------------------------ > "content of SBEditableTextShape - same as the attachement" > 'From Pharo4.0 of 18 March 2013 [Latest update: #40470] on 1 February 2015 at 10:13:04.069249 pm'! > TRShape subclass: #SBEditableTextShape > instanceVariableNames: 'txMorph txModel wrapMorph textMorph' > classVariableNames: '' > poolDictionaries: '' > category: '_Sandbox'! > > !SBEditableTextShape methodsFor: 'drawing' stamp: 'PeterUhnak 2/1/2015 22:10'! > drawOn: aCanvas > " aCanvas fullDrawMorph: textMorph." > aCanvas fullDrawMorph: txMorph.! ! > > > !SBEditableTextShape methodsFor: 'initialization' stamp: 'PeterUhnak 2/1/2015 22:07'! > initialize > | string | > super initialize. > string := 'quick brown fox jumps over the lazy dog'. > > txModel := string asTxModel. > txMorph := TxTextEditorMorph text: txModel. > txMorph extent: 150 @ 50. > > textMorph := PluggableTextFieldMorph new. > textMorph extent: 150 @ 50. > textMorph setText: string. > textMorph ghostText: 'ghost text'.! ! > ------------------------------------------------ > > Any help is appreciated, > Peter > > <SBEditableTextShape.st> > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
CONTENTS DELETED
The author has deleted this message.
|
Yes!
This is exactly what I was looking for... I've already started integrating it. :) Few things: * Text is not updated as expected ------------------- v := RTView new. shape := RTEditableLabel new. shape text: 'Old Text'. el := shape element. v add: el @ RTDraggable. v open. el shape text: 'New Text'. "this is not propagated as it would with RTLabel" el update. v signalUpdate. ------------------------ This could be circumvented by RTEditableLabel>>textFor: not making check whether the text is already set and instead set it always (probably not the best way) * Model is not updated This is perhaps broader issue and looking at RTLabelTest>>testEditableLabel it seems like intended behavior. Considering that going from shape to model to change the text may not be straightforward (in the test the model is number, not string, so casting would be required)... perhaps there could be either callback (whenTextChanged: aBlock, although that sounds very Spec-y), or using an event - e.g. "TRShapeEvent subclass: #TRTextChanged". Having a shape event sounds at least to me much more appropriate. There are also couple minor things, like the way it is invoked (I would prefer keyboard shortcuts... e.g. <esc> to cancel, <enter> to confirm (for single-line), <f2> to edit... but that is just my muscle memory from Modelio (GEF Eclipse)). Speaking of single-line I really like the distinction, since very often I want to keep labels always single-line. Thanks! Peter On Thu, Feb 12, 2015 at 9:25 PM, milton mamani <[hidden email]> wrote:
_______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Milton?
Alexandre > On Feb 13, 2015, at 9:22 AM, Peter Uhnák <[hidden email]> wrote: > > Yes! > > This is exactly what I was looking for... I've already started integrating it. :) > > Few things: > > * Text is not updated as expected > ------------------- > v := RTView new. > > shape := RTEditableLabel new. > shape text: 'Old Text'. > el := shape element. > > v add: el @ RTDraggable. > v open. > > el shape text: 'New Text'. "this is not propagated as it would with RTLabel" > el update. > v signalUpdate. > ------------------------ > This could be circumvented by RTEditableLabel>>textFor: not making check whether the text is already set and instead set it always (probably not the best way) > > * Model is not updated > This is perhaps broader issue and looking at RTLabelTest>>testEditableLabel it seems like intended behavior. > Considering that going from shape to model to change the text may not be straightforward (in the test the model is number, not string, so casting would be required)... > perhaps there could be either callback (whenTextChanged: aBlock, although that sounds very Spec-y), or using an event - > e.g. "TRShapeEvent subclass: #TRTextChanged". Having a shape event sounds at least to me much more appropriate. > > > There are also couple minor things, like the way it is invoked (I would prefer keyboard shortcuts... e.g. <esc> to cancel, <enter> to confirm (for single-line), <f2> to edit... but that is just my muscle memory from Modelio (GEF Eclipse)). > Speaking of single-line I really like the distinction, since very often I want to keep labels always single-line. > > Thanks! > > Peter > > > On Thu, Feb 12, 2015 at 9:25 PM, milton mamani <[hidden email]> wrote: > Hi Peter, > > Can you get the last Roassal Version and try the next piece of code? > > .=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.= > | v shape | > v := RTView new. > 1 to: 20 do: [ :i | > shape := RTEditableLabel new. > shape text: > 'Red > Yellow > Green'. > v add: shape element@RTDraggable. > ]. > RTGridLayout on: v elements. > > v open > .=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.= > > or simple line > > .=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.= > > | v shape | > v := RTView new. > 1 to: 20 do: [ :i | > shape := RTEditableLabel new. > shape text: 'Hello World'. > v add: shape element@RTDraggable. > ]. > RTGridLayout on: v elements. > > v open > .=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.=.= > > Press double-click over one element to edit the text of that shape. > > Please, tell me what do you think about this. > > Cheers, > Milton > > 2015-02-02 14:19 GMT-03:00 Alexandre Bergel <[hidden email]>: > > Hi Peter! > > We will have a look at your code. > > Cheers, > Alexandre > > > > > Le 1 févr. 2015 à 18:21, Peter Uhnák <[hidden email]> a écrit : > > > > Hi, > > > > is it possible to embed (any) editable text field inside Roassal? > > > > I managed to add the editor morph inside Trachel's athens canvas, however there is no way I can access it... my guess is that TRMorph takes all the events, or drawing the morph on the canvas destroys something. > > > > I tried it with PluggableTextFieldMorph (shows the border of the edit field, but no text), and TxTextEditorMorph (shows text). > > > > Is there any way around this? Adding the morph inside AthensWrapMorph works correctly, so my guess is that TRMorph must be doing something... perhaps I should also add it as a submorph of TRMorph somehow? > > > > My testing code follows: > > > > ------------------------------------------------ > > "opening the canvas and adding custom shape" > > trCanvas := TRCanvas new. > > > > text := SBEditableTextShape new. > > trCanvas addShape: text. > > > > trCanvas open. > > ------------------------------------------------ > > > > ------------------------------------------------ > > "content of SBEditableTextShape - same as the attachement" > > 'From Pharo4.0 of 18 March 2013 [Latest update: #40470] on 1 February 2015 at 10:13:04.069249 pm'! > > TRShape subclass: #SBEditableTextShape > > instanceVariableNames: 'txMorph txModel wrapMorph textMorph' > > classVariableNames: '' > > poolDictionaries: '' > > category: '_Sandbox'! > > > > !SBEditableTextShape methodsFor: 'drawing' stamp: 'PeterUhnak 2/1/2015 22:10'! > > drawOn: aCanvas > > " aCanvas fullDrawMorph: textMorph." > > aCanvas fullDrawMorph: txMorph.! ! > > > > > > !SBEditableTextShape methodsFor: 'initialization' stamp: 'PeterUhnak 2/1/2015 22:07'! > > initialize > > | string | > > super initialize. > > string := 'quick brown fox jumps over the lazy dog'. > > > > txModel := string asTxModel. > > txMorph := TxTextEditorMorph text: txModel. > > txMorph extent: 150 @ 50. > > > > textMorph := PluggableTextFieldMorph new. > > textMorph extent: 150 @ 50. > > textMorph setText: string. > > textMorph ghostText: 'ghost text'.! ! > > ------------------------------------------------ > > > > Any help is appreciated, > > Peter > > > > <SBEditableTextShape.st> > > _______________________________________________ > > Moose-dev mailing list > > [hidden email] > > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.iam.unibe.ch/mailman/listinfo/moose-dev -- _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. _______________________________________________ Moose-dev mailing list [hidden email] https://www.iam.unibe.ch/mailman/listinfo/moose-dev |
Free forum by Nabble | Edit this page |