Administrator
|
I want to specify that the label column should shrinkWrap the text. In Morphic, it would be something like:
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… 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 |
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 <[hidden email]> wrote: I want to specify that the label column should shrinkWrap the text. In |
Administrator
|
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 |
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 <[hidden email]> wrote: Benjamin Van Ryseghem-2 wroteA dirty patch in the meantime would be to specify the policy to the morph |
Administrator
|
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 |
Free forum by Nabble | Edit this page |