I've hacked Glamour in two places recently to great effect, and I wonder
what the community thinks about these new features.
Both involve allowing arbitrary morphs in place of assumed images or text.
1) I found myself wanting to have act: icons that changed state, acting
like a toggle. In my case I wanted to use a
PluggableThreePhaseButtonMorph.
A one line mode to GLMMorphicRender>>renderAction: did the trick
renderAction: anAction
^(UITheme current
newButtonIn: nil
for: anAction
getState: nil
action: #morphicActOn:
arguments: {}
getEnabled: nil
>>>> label: (anAction icon isMorph
ifFalse:[AlphaImageMorph new image:
anAction icon]ifTrue:[anAction icon])
<<<<<<<<
help: (anAction title, Character tab asString, anAction
shortcutAsString) trimBoth)
valueOfProperty: #noBorder ifAbsentPut: [true]; "this is a hack
to tell the GLMUITheme to not draw the border and the fill"
valueOfProperty: #noFill ifAbsentPut: [true];
setProperty: #wantsKeyboardFocusNavigation toValue: false; "to
disable the focus"
yourself
2) I also needed to embed morphs in table presentations to allow editing of
the cell text.
Again, a single change to GLMTreeMorphNodeModel>>rowMorphForColumn:
rowMorphForColumn: aGlamourColumn
| content |
content := self containerTree glamourPresentation column:
aGlamourColumn valueFor: self item.
>>>> ^content isString ifTrue:[StringMorph
contents: content]
ifFalse:[content] <<<<<<<<
This lead me to customize a subclass of PluggableTextMorph to use blocks
instead of the model>>selector approach for pluggable behavior, especially
so it would work nicely in a Glamour script and all the context to be
referenced on the getText/setText etc operations.
These are obviously hacks but since both cases are wanting a morph and
seemingly don't really need a morph of the original type (Image or String)
they should be generalized to allow arbitrary morphs.
This also led me to imagine embedding full presentations or visualizations
into table cells, but that's beyond my understanding of the framework at
this point.
Reminds me of the old XEROX Analyst spreadsheet.
Regards,
Sam
Sam S. Adams, CTO - Contextual Computing
IBM Distinguished Engineer, IBM Research
Mobile: 919-696-6064, email: ssadams(a)us.ibm.com
Assistant: Linda R. Morrison. (720) 395-0460 Fax: (845) 491-4318, Tie:
676-0460, linda.r.morrison(a)us.ibm.com
<<Hebrews 11:6, Proverbs 3:5-6, Romans 1:16-17, 1 Corinthians 1:10>>