@felix wrote:
Hello,
my nodes look like this:
------------ | Title | | items[0] | | sub[a] | | sub[b] | | items[1] | | sub[a] | ------------The title, and each of the variable number of items and subs, is made up of an editable
TextBlock. Depending on which kind ofTextBlockis edited, I want different consequences.When the Title is modified, I want a call
titleModified(nodeKey).to happen.
When an item is modified, I want a call toitemModified(nodeKey,itemKey).
When a sub is modified, I want a call tosubModified(nodeKey,itemKey,subKey).
(I know how to findsubKeyanditemKeygiven thepartin which theTextBlockthat was edited sits.)How can I easily detect whether a
title,item, orsub TextBlockwas modified, using a listener?I didn't find a
textEditedproperty for theTextBlockwhere I can assign an event handler. Is there one?
TheTextBlocksall use.makeTwoWay(), so I could set a differentbackConverterfor each. But this is ruled out by the documentation:Conversion functions must not have any side-effects other than setting the source property.
I am currently using the
textEditedlistener on the diagram, but it's hard to evaluate what kind of textblock the event came from. If I could assigncategory:"title",category:"item"orcategory:"sub"to myTextBlock, the problem would be solved, but I cannot see such a possibility.
If it's possible to do this using aChangedEvent(presumably using amodelChangeof typenodeDataArray), what is the pattern for doing so? This is my least-preferred solution, since I find filtering through hundreds of changes in the transaction until I've found the right one unintuitive -- and the functionstitleModified itemModified subModifiedmake further changes to the model, so I have to queue the changes to happen after identifying those necessary changes in atransaction.changes.eachcall; I only know how to organise this in awkward ways.
Posts: 4
Participants: 2