I'm trying to understand how to copy a rubric text morph. I don't have a 2nd implementor of #text:textStyle:textColor so how does this work? RubAbstractTextArea>>text: t textStyle: s color: c textColor: tc "Private -- for use only in morphic duplication" self releaseParagraph. super text: t textStyle: s color: c textColor: tc.
Hi Stephan, I looked into the bug a bit and found something strange.... | m m2 | m := ColorPanel open. m2 := m submorphs third copy. m = m2 panel. "prints false; the panel is duplicated " ------------- add this method to DragWelL: veryDeepInner: deepCopier super veryDeepInner: deepCopier and it returns true. Another observation is that after all the text is lost, if you have a Playground that is effected and try to do something like: (ColorPanel allInstances size.) it raises an error 'MessageNotUnderstood: receiver of "style:" is nil' from "a GLMMorphicPharoPlaygroundRenderer actOnHighlightAndEvaluate: ann" Hope this helps Best regards, Henrik -----Original Message----- From: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] On Behalf Of Stephan Eggermont Sent: Friday, September 18, 2015 4:09 PM To: pharo-dev@lists.pharo.org Subject: [Pharo-dev] RubAbstractTextArea copying I'm trying to understand how to copy a rubric text morph. I don't have a 2nd implementor of #text:textStyle:textColor so how does this work? RubAbstractTextArea>>text: t textStyle: s color: c textColor: tc "Private -- for use only in morphic duplication" self releaseParagraph. super text: t textStyle: s color: c textColor: tc.
On 18-09-15 16:50, Henrik Nergaard wrote:
I looked into the bug a bit and found something strange....
| m m2 |
m := ColorPanel open. m2 := m submorphs third copy. m = m2 panel. "prints false; the panel is duplicated "
Yes, that is a bug, that should stay the same.
add this method to DragWelL:
veryDeepInner: deepCopier super veryDeepInner: deepCopier
That seems to work.
Another observation is that after all the text is lost, if you have a Playground that is effected and try to do something like: (ColorPanel allInstances size.) it raises an error 'MessageNotUnderstood: receiver of "style:" is nil' from "a GLMMorphicPharoPlaygroundRenderer actOnHighlightAndEvaluate: ann"
Yes. All editors break. That is independent of the ColorPanel, I've verified with the cloning of cards. I just don't know how I can safely copy a Rubric editor morph. Either directly, or through its textModel. Stephan
It does not seem that RubScrolledTextMorph supports duplication/copy (tried to duplicate one from nautilus code area and the same clear all code happened. Trying to duplicate a Playground just freezes the image (might be some circular references that is not handled when copying )). Anyway: this code works ish.. (does not add unaccepted edits) CodeCard>>#duplicate | newCard | newCard := self class new. newCard selector: self selector; "must be before selectedClass" selectedClass: self selectedClass; updateCodeWith: self textModel text. self activeHand attachMorph: newCard. "attachMorph: is nicer than grabMorph: :)" selected := false. self changed. Best regards, Henrik -----Original Message----- From: Pharo-dev [mailto:pharo-dev-bounces@lists.pharo.org] On Behalf Of Stephan Eggermont Sent: Friday, September 18, 2015 6:19 PM To: pharo-dev@lists.pharo.org Subject: Re: [Pharo-dev] RubAbstractTextArea copying On 18-09-15 16:50, Henrik Nergaard wrote:
I looked into the bug a bit and found something strange....
| m m2 |
m := ColorPanel open. m2 := m submorphs third copy. m = m2 panel. "prints false; the panel is duplicated "
Yes, that is a bug, that should stay the same.
add this method to DragWelL:
veryDeepInner: deepCopier super veryDeepInner: deepCopier
That seems to work.
Another observation is that after all the text is lost, if you have a Playground that is effected and try to do > something like: (ColorPanel allInstances size.) it raises > an error 'MessageNotUnderstood: receiver of "style:" is nil' from "a GLMMorphicPharoPlaygroundRenderer actOnHighlightAndEvaluate: ann"
Yes. All editors break. That is independent of the ColorPanel, I've verified with the cloning of cards. I just don't know how I can safely copy a Rubric editor morph. Either directly, or through its textModel. Stephan
On 18-09-15 22:52, Henrik Nergaard wrote:
It does not seem that RubScrolledTextMorph supports duplication/copy (tried to duplicate one from nautilus code area and the same clear all code happened. Trying to duplicate a Playground just freezes the image (might be some circular references that is not handled when copying )).
Anyway: this code works ish.. (does not add unaccepted edits)
CodeCard>>#duplicate | newCard |
newCard := self class new. newCard selector: self selector; "must be before selectedClass" selectedClass: self selectedClass; updateCodeWith: self textModel text. self activeHand attachMorph: newCard. "attachMorph: is nicer than grabMorph: :)"
selected := false. self changed.
Thanks Henrik. I'm slowly getting to the finer points of Morphic. Stephan
participants (2)
-
Henrik Nergaard -
Stephan Eggermont