Hi Sam,
On Fri, Jan 10, 2014 at 5:58 PM, Sam Adams <ssadams(a)us.ibm.com> wrote:
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
Interesting. We certainly do need to extend Glamour to support preferences
not just actions, and a toggle is one kind of preferences. With your
approach, you would not have access from the browser to the value of the
toggle, and this would make it less valuable. A better approach would be to
subclass Action with a ToggleAction and model it explicitly. Would you like
to give this a try?
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.
Nice. I integrated this one simply by calling asMorph to content.
Cheers,
Doru
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<https://w3-connections.ibm.com/communities/service/html/commun…
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>>
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--
www.tudorgirba.com
"Every thing has its own flow"