When the tree is in multiple selection mode (which is the default mode), an item being 'active' and an item being 'selected' are two different things. There is always exactly one active item in the tree, while there can be zero or more selected items. When you want to be notified when the active item changes, call GetActiveTreeItem when you receive an EVENT_VAL_CHANGED with eventData1 equal to ACTIVE_ITEM_CHANGE.
As for the EVENT_SELECTION_CHANGE, it is swallowable, so the state of the tree can't be changed by the time you receive the event. This is why eventData1 and eventData2 tell you what is about to happen if you do not swallow the event. eventData1 indicates whether the item is being selected or unselected and eventData2 indicates the item.
Try adding this to the function treeCallback in the sample code treeevent.c.
case EVENT_VAL_CHANGED:
if (ACTIVE_ITEM_CHANGE == eventData1)
{
GetActiveTreeItem (panelHandle, PANEL_TREE, &activeIndex);
GetLabelFromIndex (panelHandle, PANEL_TREE, activeIndex, label1);
Fmt (msg, "%s<%d) EVENT_VAL_CHANGED: '%s' is the new active index\n",
eventCnt++, label1);
SetCtrlVal (panelHandle, PANEL_TEXTBOX, msg);
}
break;