How Do I Respond to any Expand/Collapse Activity Performed on the Tree Control By the End User? (Magic xpa 4.x)
Sometimes you may want to perform an action only when a certain node is expanded or collapsed. For example, you might want to run a task to create a subtotal that will be visible to the user. Or, you might want to create the child nodes at runtime; using a memory table for the tree, you can display customized data on each node.
To do this, you use the Expand Node and Collapse Node Events as Logic units.
-
Press Ctrl+H to create a logic unit.
-
Type E for Event, then select the Internal Event Expand Node or Collapse Node.
-
You will see a dialog box, “Create Parameter variables to match parameters to the event?”. Click the Yes button if you want the Tree Node Level and Tree Node Value variables to be created for you.
-
Now, you have a handler that will execute when the user expands or collapses the node. You can ascertain the node level and value by using the parameter variables in the handler.
-
In the Event Properties, set Propagate to Yes, otherwise this handler will trap the event and the node will not collapse or expand.
The Online and Rich Client Samples projects (program TR13 and RTR13)