Lukas suggested I repost this here from the Magritte list (http://forum.world.st/Customizing-Magritte-Morphic-Forms-td4251518.html):
I'm playing with and already enjoying Magritte after the awesome talk Nick and Esteban gave at ESUG this year.
How do I customize Magritte editors in Morphic? Specifically, for the Address example from the Seaside book, I tried: anAddress asMorph addButtons; addWindow; openInWorld.
but the fields were really tiny and hid most of the text as you can see below: http://forum.world.st/file/n4251570/PharoScreenshot.2.png
Then I tried a standard Morphic approach: | form window | form := anAddress asMorph addButtons. window := SystemWindow new addMorph: form fullFrame: (LayoutFrame fractions: (0@0 corner: 1.0@1.0) offsets: (10@10 corner: 10@10)). window openInWorld.
but I got "MessageNotUnderstood: MAContainerMorph>>layoutFrame:"
-- View this message in context: http://forum.world.st/Customizing-Magritte-Morphic-Forms-tp4251570p4251570.h... Sent from the Moose mailing list archive at Nabble.com.
As replied on the smallwiki mailing list:
Here is the code from the rendering in Glamour:
magritteMorph := FAMIXClass asMooseDescription asMagritteDescription asMorph addButtons; morph. scrollPane := GeneralScrollPane new. scrollPane changeScrollerTableLayout. scrollPane scrollTarget: magritteMorph. scrollPane layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 1)). scrollPane openInWindow
I use the GeneralScrollPane because it lets you fill on one dimension and have a scroll on the other dimension.
Cheers, Doru
On 1 Jan 2012, at 22:01, Sean P. DeNigris wrote:
Lukas suggested I repost this here from the Magritte list (http://forum.world.st/Customizing-Magritte-Morphic-Forms-td4251518.html):
I'm playing with and already enjoying Magritte after the awesome talk Nick and Esteban gave at ESUG this year.
How do I customize Magritte editors in Morphic? Specifically, for the Address example from the Seaside book, I tried: anAddress asMorph addButtons; addWindow; openInWorld.
but the fields were really tiny and hid most of the text as you can see below: http://forum.world.st/file/n4251570/PharoScreenshot.2.png
Then I tried a standard Morphic approach: | form window | form := anAddress asMorph addButtons. window := SystemWindow new addMorph: form fullFrame: (LayoutFrame fractions: (0@0 corner: 1.0@1.0) offsets: (10@10 corner: 10@10)). window openInWorld.
but I got "MessageNotUnderstood: MAContainerMorph>>layoutFrame:"
-- View this message in context: http://forum.world.st/Customizing-Magritte-Morphic-Forms-tp4251570p4251570.h... Sent from the Moose mailing list archive at Nabble.com. _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Yesterday is a fact. Tomorrow is a possibility. Today is a challenge."
Thanks for the immediate feedback!
I realized from your snippet what was missing in my attempt:
| form window | form := anAddress asMorph addButtons. window := SystemWindow new addMorph: form ***morph*** fullFrame: (LayoutFrame fractions: (0@0 corner: 1.0@1.0) offsets: (10@10 corner: 10@10)). window openInWorld.
OMG! It seems terribly misleading to me to call something a morph that is not a morph. This violates the principle of least surprise, and while surprises are nice today because it's a holiday, not so much the rest of the year ;-)
Humble suggestions: 1) change #asMorph to something like forMorphic 2) make #addWindow behave more reasonably 3) MAContainerMorph and friends -> MAMorphicContainer
-- View this message in context: http://forum.world.st/Customizing-Magritte-Morphic-Forms-tp4251570p4251621.h... Sent from the Moose mailing list archive at Nabble.com.
Tudor Girba-2 wrote
Here is the code from the rendering in Glamour:
With this approach: morph := anAddress asMorph addButtons; morph. scrollPane := GeneralScrollPane new. scrollPane changeScrollerTableLayout. scrollPane scrollTarget: morph. scrollPane layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 1)). scrollPane openInWindow
I got an emergency evaluator when I clicked "Save":
THERE_BE_DRAGONS_HERE SubscriptOutOfBounds: 1 1 January 2012 5:24:26 pm
VM: Mac OS - intel - 1072 - Croquet Closure Cog VM [CoInterpreter VMMaker-oscog-EstebanLorenzano.139] 21.0 Image: Pharo1.3 [Latest update: #13320]
Array(Object)>>errorSubscriptBounds: Receiver: #() Arguments and temporary variables: index: 1 Receiver's instance variables: #()
Array(Object)>>at: Receiver: #() Arguments and temporary variables: index: 1 Receiver's instance variables: #()
Array(SequenceableCollection)>>first Receiver: #() Arguments and temporary variables:
Receiver's instance variables: #()
GeneralScrollPane>>scrollTarget Receiver: a GeneralScrollPane(440139776) Arguments and temporary variables:
Receiver's instance variables: bounds: 50@139 corner: 686@431 owner: a SystemWindow(908591104) submorphs: an Array(a TransformWithLayoutMorph(445382656)) fullBounds: 50@139 corner: 686@431 color: Color transparent extension: a MorphExtension (222822400) [other: (myDependents -> a DependentsA...etc... scroller: a TransformWithLayoutMorph(445382656) hScrollbar: a GeneralScrollBar(471334912) vScrollbar: a GeneralScrollBar(237240320)
-- View this message in context: http://forum.world.st/Customizing-Magritte-Morphic-Forms-tp4251570p4251729.h... Sent from the Moose mailing list archive at Nabble.com.
Oh, right.
I only provided the code for rendering, but it does not work when you execute it :).
The problem is that The MAContainerMorph does some morph removing magic that does not work with the GeneralScrollPane. So, I am replacing it with a MASilentContainerMorph. It's hack-ish, but it works. I would actually be interested in a cleaner solution.
Also, I did not provide a good model for the description.
model := MooseModel root allModels first allClasses first "or your code". description := FAMIXClass asMooseDescription asMagritteDescriptionWithAnnotations "or your code".
(description morphClass = MAContainerMorph) ifTrue: [description morphClass: MASilentContainerMorph]. magritteMorph := (description asMorphOn: model) addButtons; morph. scrollPane := GeneralScrollPane new. scrollPane changeScrollerTableLayout. scrollPane scrollTarget: magritteMorph. scrollPane layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 1)). scrollPane openInWindow
Cheers, Doru
On 1 Jan 2012, at 23:27, Sean P. DeNigris wrote:
Tudor Girba-2 wrote
Here is the code from the rendering in Glamour:
With this approach: morph := anAddress asMorph addButtons; morph. scrollPane := GeneralScrollPane new. scrollPane changeScrollerTableLayout. scrollPane scrollTarget: morph. scrollPane layoutFrame: (LayoutFrame fractions: (0 @ 0 corner: 1 @ 1)). scrollPane openInWindow
I got an emergency evaluator when I clicked "Save":
THERE_BE_DRAGONS_HERE SubscriptOutOfBounds: 1 1 January 2012 5:24:26 pm
VM: Mac OS - intel - 1072 - Croquet Closure Cog VM [CoInterpreter VMMaker-oscog-EstebanLorenzano.139] 21.0 Image: Pharo1.3 [Latest update: #13320]
Array(Object)>>errorSubscriptBounds: Receiver: #() Arguments and temporary variables: index: 1 Receiver's instance variables: #()
Array(Object)>>at: Receiver: #() Arguments and temporary variables: index: 1 Receiver's instance variables: #()
Array(SequenceableCollection)>>first Receiver: #() Arguments and temporary variables:
Receiver's instance variables: #()
GeneralScrollPane>>scrollTarget Receiver: a GeneralScrollPane(440139776) Arguments and temporary variables:
Receiver's instance variables: bounds: 50@139 corner: 686@431 owner: a SystemWindow(908591104) submorphs: an Array(a TransformWithLayoutMorph(445382656)) fullBounds: 50@139 corner: 686@431 color: Color transparent extension: a MorphExtension (222822400) [other: (myDependents -> a DependentsA...etc... scroller: a TransformWithLayoutMorph(445382656) hScrollbar: a GeneralScrollBar(471334912) vScrollbar: a GeneralScrollBar(237240320)
-- View this message in context: http://forum.world.st/Customizing-Magritte-Morphic-Forms-tp4251570p4251729.h... Sent from the Moose mailing list archive at Nabble.com. _______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com
"Be rather willing to give than demanding to get."
Tudor Girba-2 wrote
...I would actually be interested in a cleaner solution...
I'll let you know if I come up with anything. For my current experiment, the fixed #addWindow is enough
-- View this message in context: http://forum.world.st/Customizing-Magritte-Morphic-Forms-tp4251570p4251811.h... Sent from the Moose mailing list archive at Nabble.com.