11-22-2012 07:33 AM
Hello
I don't understand how EVENT_COLLAPSE and EVENT_EXPAND work on a tree control.
Using the following code
case EVENT_EXPAND:
GetTreeItemAttribute (FL_TreeListPanel, TREE_LIST_LIST, eventData2, ATTR_COLLAPSED, &FL_ItemCollapsed);
break;
FL_ItemCollapsed is equal to 1. I was expecting 0 because a click on the + expands the tree.
In fact I want to adjust the height of the tree control to the number of exposed items.
I could notice that with
GetTreeItemAttribute (FL_TreeListPanel, TREE_LIST_LIST, ItemIndex, ATTR_COLLAPSED, &FL_ItemCollapsed);
FL_ItemCollapsed is equal to 0 only after the callback function is finished. So I'm wondering how I could handle this situation in the Callback function.
Best regards
Solved! Go to Solution.
11-22-2012 09:46 AM - edited 11-22-2012 09:47 AM
As stated in the help, EVENT_EXPAND and EVENT_COLLAPSE are swallovable events: that means that you receive them before their effect realized, so that you can swallow them (i.e. abort them, do as if they didn't succeed). One possible solution to this problem is to PostDeferredCall a function so that it is executed after the expand/collapse event has terminated.
You can search treeevent example on your machine: there is a example of PostDeferredCall associated to EVENT_EDIT_MODE_STATE_CHANGE event.
11-22-2012 02:09 PM
Thank you for your quick and appropriate help