Thanks Johan, now I'm in the right path. I have implemented basic
persistence and now I'm working on the add/remove promote/demote node
operations and I need to revisit the body persistence after that to make
it work on each node.
Cheers,
Offray
On 26/07/16 15:32, Johan Fabry wrote:
No, this is not in initializePresenter, since this is called only once, when
the window is opened. Instead, you need to do this every time that the widget
is changed. So in your code where you change the widget to a new one, I guess
this is changeBody: , you need to configure this new widget.
--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please
see http://emailcharter.org .
Johan Fabry - http://pleiad.cl/~jfabry
PLEIAD and RyCh labs - Computer Science Department (DCC) - University of
Chile
On Jul 26, 2016, at 16:08, Offray Vladimir Luna Cárdenas
<offray.l...@mutabit.com> wrote:
Thanks Johan for your quick answer.
Your hypothesis is right and the contents of (4) are cleaned by a new widget
when I click at the tree (2). I'm looking at my code and documentation, but I
can't find properly how to implement your recommendation. I imagine is
somewhere in initializePresenter, but I can't find the place... sorry I would
like to be more helpful on getting help... :-/.
Any hint of how this code should look like and where it goes? "body whenTextChanged:
aBlock" on initializePresenter seems doing nothing.
Cheers,
Offray
On 26/07/16 11:19, Johan Fabry wrote:
I think the problem is that when you click on an item in the tree (2), the
contents of (4) is changed to a new widget. As a result the configuration that
you did in initializePresenter is lost. What you should do is when you change
the contents of (4) also configure this new widget with a whenTextChanged:
block. I think that will solve your problem.
--
Does this mail seem too brief? Sorry for that, I don’t mean to be rude! Please
see http://emailcharter.org .
Johan Fabry - http://pleiad.cl/~jfabry
PLEIAD and RyCh labs - Computer Science Department (DCC) - University of
Chile
On Jul 25, 2016, at 18:12, Offray Vladimir Luna Cárdenas
<offray.l...@mutabit.com> wrote:
Hi,
I'm migrating my grafoscopio interface from I'm trying to capture some changes
in a text morph that is part of a Spec interface. The interface is split in 4
parts, as you can see at [a]: (1) a main menu, (2) a tree, (3) a node header
input text and (4) a text morph. When you click any node on the tree (2) the
name of the node, called the header is shown in (3) and the node contents,
called the body are shown at (4). If you made a change in the header (pressing
enter) it's reflected back to the main tree. And the node's body is changed for
a text morph [b] or a and embedded playground [c] according to tags in the
node. So the reading part is working and I have some partial support for
persistence, at least for node headers.
[a] https://offray.withknown.com/2016/grafoscopio-notebook-interface
[b] https://offray.withknown.com/2016/grafoscopio-text-node
[c] https://offray.withknown.com/2016/grafoscopio-code-node
Now I would like to extend the persistence for node's body content, so when any
changes happens in the (4) panel, be it a text panel or a playground, it is
stored in a similar way to what is happening with node headers and the (3)
panel, but I'm unsuccessful trying to capture those changes.
My initializeWidgets and initializePresenter are implemented this way:
=================
GrafoscopioNotebook>>initializeWidgets
windowMainMenu := self newWindowMainMenu.
tree := TreeModel new.
body := self newText.
header := self newTextInput.
body disable.
body text: '<-- Select a node in the left panel'.
tree
childrenBlock: [:node | node children];
displayBlock: [:node | node title ].
=================
initializePresenter
tree whenSelectedItemsChanged: [ :arg |
arg isEmpty ifFalse: [self changeBody: arg ]].
header whenTextChanged: [ :arg |
Transcript show: arg.
(tree selectedItem content header) = arg
ifFalse: [
(tree selectedItem) content header: arg.
tree roots: tree roots]].
body whenTextIsAccepted: [ :arg |
Transcript show: arg
]
=================
I'm capturing properly the changes in text with whenTextChanged on the header
but using the same message on body or whenTextIsAccepted doesn't produce any
change on the trascript, and of course I can't update the any tree/node
contents properly.
Any advice on how to solve this will be greatly appreciated. If can happen soon
in this week even better, because we could show this to our hackathon/workshop
attendees.
Cheers,
Offray