I want to specify that the label column should shrinkWrap the text. In Morphic, it would be something like:
gui := Morph new changeTableLayout; layoutInset: 10@10; listDirection: #leftToRight; vResizing: #spaceFill; hResizing: #spaceFill; yourself.
row := UITheme current builder newRow: { TextMorph new contents: 'label'; color: Color yellow; yourself. Morph new color: Color green; hResizing: #spaceFill; yourself }. row hResizing: #spaceFill.
gui addMorphBack: row.
gui openInWindow.
Any time 'label' changes to a shorter or longer string, both the label and green morph adjust accordingly. Right now, DateModel has this in class-side #specâ¦
^ SpecLayout composed newRow: [ :row | row add: #dateLabel" width: 60"; "This is to address a not yet fixed Spec issue" newRow: [:ugly | ugly add: #dateModel; add: #chooseDateButton width: 50 ]] height: 25 yourself.
Currently, since the label column width is hard-coded, substituting longer labels looks really crappy. I don't remember what the "issue" was, but how do I recreate the above Morphic behavior with Spec? ----- Cheers, Sean -- View this message in context: http://forum.world.st/DateModel-label-width-tp4733674.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
I am currently working on a way to specify different layout policy. But until it works, there is no real way to do it. A dirty patch in the meantime would be to specify the policy to the morph when built. Ben On 02 Jan 2014, at 16:26, Sean P. DeNigris <sean@clipperadams.com> wrote:
I want to specify that the label column should shrinkWrap the text. In Morphic, it would be something like:
gui := Morph new changeTableLayout; layoutInset: 10@10; listDirection: #leftToRight; vResizing: #spaceFill; hResizing: #spaceFill; yourself.
row := UITheme current builder newRow: { TextMorph new contents: 'label'; color: Color yellow; yourself. Morph new color: Color green; hResizing: #spaceFill; yourself }. row hResizing: #spaceFill.
gui addMorphBack: row.
gui openInWindow.
Any time 'label' changes to a shorter or longer string, both the label and green morph adjust accordingly.
Right now, DateModel has this in class-side #specâ¦
^ SpecLayout composed newRow: [ :row | row add: #dateLabel" width: 60"; "This is to address a not yet fixed Spec issue" newRow: [:ugly | ugly add: #dateModel; add: #chooseDateButton width: 50 ]] height: 25 yourself.
Currently, since the label column width is hard-coded, substituting longer labels looks really crappy. I don't remember what the "issue" was, but how do I recreate the above Morphic behavior with Spec?
----- Cheers, Sean -- View this message in context: http://forum.world.st/DateModel-label-width-tp4733674.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Benjamin Van Ryseghem-2 wrote
A dirty patch in the meantime would be to specify the policy to the morph when built.
A workaround would be fine for the moment. Were you suggesting a mess ( ;-) ) like the following? ⦠open | windowModel paperworkDateWidget labelWidget | windowModel := self new openWithSpec. paperworkDateWidget := windowModel window submorphs last firstSubmorph submorphs seventh firstSubmorph firstSubmorph. paperworkDateWidget hResizing: #spaceFill; changeTableLayout; listDirection: #rightToLeft. labelWidget := paperworkDateWidget submorphs second. labelWidget hResizing: #shrinkWrap. labelWidget width: 155. ----- Cheers, Sean -- View this message in context: http://forum.world.st/DateModel-label-width-tp4733674p4733757.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
I think we can do better :P (with still a workaround) Let me digest my jet lag (just arrived at Santiago) and I will give you a real answer :P Ben On 02 Jan 2014, at 20:16, Sean P. DeNigris <sean@clipperadams.com> wrote:
Benjamin Van Ryseghem-2 wrote
A dirty patch in the meantime would be to specify the policy to the morph when built.
A workaround would be fine for the moment. Were you suggesting a mess ( ;-) ) like the following? â¦
open
| windowModel paperworkDateWidget labelWidget | windowModel := self new openWithSpec. paperworkDateWidget := windowModel window submorphs last firstSubmorph submorphs seventh firstSubmorph firstSubmorph. paperworkDateWidget hResizing: #spaceFill; changeTableLayout; listDirection: #rightToLeft. labelWidget := paperworkDateWidget submorphs second. labelWidget hResizing: #shrinkWrap. labelWidget width: 155.
----- Cheers, Sean -- View this message in context: http://forum.world.st/DateModel-label-width-tp4733674p4733757.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Benjamin Van Ryseghem-2 wrote
I think we can do better :P (with still a workaround)
I was being a bit dramatic ;) I ended up with a slightly less depressing: open | windowModel labelMorphs | windowModel := self new openWithSpec. labelMorphs := windowModel window allMorphs select: [ :e | e isKindOf: LabelMorph ]. labelMorphs do: [ :e | self workAroundLabelAlignmentOf: e ]. workAroundLabelAlignmentOf: aLabelMorph | isSpecLabel | isSpecLabel := aLabelMorph model isKindOf: LabelModel. isSpecLabel ifFalse: [ ^ self ]. aLabelMorph owner hResizing: #spaceFill; changeTableLayout; listDirection: #rightToLeft. aLabelMorph hResizing: #shrinkWrap; width: 155. No rush on this. I'm good for now. ----- Cheers, Sean -- View this message in context: http://forum.world.st/DateModel-label-width-tp4733674p4734026.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
participants (2)
-
Benjamin -
Sean P. DeNigris