i want to use different adaptor for TextModel, when opening my UI so that when widget is built for it, it will be my own widget, not PluggableTextMorph.. but i found it hard to do.. here what i tried: I try to replace bindings, so at the stage when spec interpreted, it uses my bindings: openWithSpec | old result | old := SpecInterpreter bindings. SpecInterpreter bindings: TxAdapterBindings new. [ result := super openWithSpec ] ensure: [ SpecInterpreter bindings: old ]. ^ result in TxAdapterBindings i initialize it same as morphic bindging, except from text model binding: #TextAdapter => #TxTextAdapter but it is never invoked nor used :( i understand the overall model, but it seems like not completely, (else the above trick would work).. what do i miss? -- Best regards, Igor Stasenko.
Igor where is your code so that I can give a try? On 22/4/14 13:56, Igor Stasenko wrote:
i want to use different adaptor for TextModel, when opening my UI so that when widget is built for it, it will be my own widget, not PluggableTextMorph..
but i found it hard to do.. here what i tried:
I try to replace bindings, so at the stage when spec interpreted, it uses my bindings:
openWithSpec
| old result | old := SpecInterpreter bindings.
SpecInterpreter bindings: TxAdapterBindings new.
[ result := super openWithSpec ] ensure: [ SpecInterpreter bindings: old ]. ^ result
in TxAdapterBindings i initialize it same as morphic bindging, except from text model binding: #TextAdapter => #TxTextAdapter
but it is never invoked nor used :(
i understand the overall model, but it seems like not completely, (else the above trick would work).. what do i miss?
-- Best regards, Igor Stasenko.
TxText-Athens-IgorStasenko.27 (TxText on smalltalkhub) just committed see TxApplicationWithToolbar TxApplicationWithToolbar new openWithSpec etc On 22 April 2014 20:21, stepharo <stepharo@free.fr> wrote:
Igor where is your code so that I can give a try?
On 22/4/14 13:56, Igor Stasenko wrote:
i want to use different adaptor for TextModel, when opening my UI so that when widget is built for it, it will be my own widget, not PluggableTextMorph..
but i found it hard to do.. here what i tried:
I try to replace bindings, so at the stage when spec interpreted, it uses my bindings:
openWithSpec
| old result | old := SpecInterpreter bindings.
SpecInterpreter bindings: TxAdapterBindings new.
[ result := super openWithSpec ] ensure: [ SpecInterpreter bindings: old ]. ^ result
in TxAdapterBindings i initialize it same as morphic bindging, except from text model binding: #TextAdapter => #TxTextAdapter
but it is never invoked nor used :(
i understand the overall model, but it seems like not completely, (else the above trick would work).. what do i miss?
-- Best regards, Igor Stasenko.
-- Best regards, Igor Stasenko.
2014-04-22 13:56 GMT+02:00 Igor Stasenko <siguctua@gmail.com>:
i want to use different adaptor for TextModel, when opening my UI so that when widget is built for it, it will be my own widget, not PluggableTextMorph..
but i found it hard to do.. here what i tried:
I try to replace bindings, so at the stage when spec interpreted, it uses my bindings:
openWithSpec
| old result | old := SpecInterpreter bindings.
SpecInterpreter bindings: TxAdapterBindings new.
[ result := super openWithSpec ] ensure: [ SpecInterpreter bindings: old ]. ^ result
in TxAdapterBindings i initialize it same as morphic bindging, except from text model binding: #TextAdapter => #TxTextAdapter
but it is never invoked nor used :(
i understand the overall model, but it seems like not completely, (else the above trick would work).. what do i miss?
-- Best regards, Igor Stasenko.
You code works, it is just that the TextModel is not the first one that calls the spec interpreter. The first one is the WindowModel. And after a spec is "interpreted" spec interpreter calls self hardResetBindings and that one reinitialize the binding to MorphicAdapterBindings. nicolai
On 22 April 2014 21:02, Nicolai Hess <nicolaihess@web.de> wrote:
2014-04-22 13:56 GMT+02:00 Igor Stasenko <siguctua@gmail.com>:
i want to use different adaptor for TextModel, when opening my UI
so that when widget is built for it, it will be my own widget, not PluggableTextMorph..
but i found it hard to do.. here what i tried:
I try to replace bindings, so at the stage when spec interpreted, it uses my bindings:
openWithSpec
| old result | old := SpecInterpreter bindings.
SpecInterpreter bindings: TxAdapterBindings new.
[ result := super openWithSpec ] ensure: [ SpecInterpreter bindings: old ]. ^ result
in TxAdapterBindings i initialize it same as morphic bindging, except from text model binding: #TextAdapter => #TxTextAdapter
but it is never invoked nor used :(
i understand the overall model, but it seems like not completely, (else the above trick would work).. what do i miss?
-- Best regards, Igor Stasenko.
You code works, it is just that the TextModel is not the first one that calls the spec interpreter. The first one is the WindowModel. And after a spec is "interpreted" spec interpreter calls self hardResetBindings and that one reinitialize the binding to MorphicAdapterBindings.
indeed.. now i wonder, why spec interpreter is doing such nasty things? because because of it, you lose any control over bindings , when building composite UI. if spec interpreter exposing bindings to outside, it must never reset them, because it should be a user's concern, when/where reset or replace them. otherwise it makes little sense in having bindings, if spec interpreter forces to always use default ones.
nicolai
-- Best regards, Igor Stasenko.
participants (3)
-
Igor Stasenko -
Nicolai Hess -
stepharo