Gadgets > Rogue Wave Views Application Framework > Actions > Processing an Action Event
 
Processing an Action Event
To process an action event, a class must insert an Action macro in its interface. The first parameter of the Action macro is the name of the action, and the second parameter is the name of the method that will process this action.
For example, here is a text view that manages the Cut action event:
IlvDvBeginInterface(MyTextView)
Action(Cut, myCut)
IlvDvEndInterface1(IlvDvTextView)
 
void
MyTextView::myCut()
{
...
}
A document or a view can manage the action state the same way as it processes an action event. It does this using the macro RefreshAction([ActionName], [MethodName]).
For example, here is a text view that manages the Cut action state:
IlvDvBeginInterface(MyTextView)
RefreshAction(Cut, refreshCut)
IlvDvEndInterface1(IlvDvTextView)
 
void
MyTextView::refreshCut(IlvDvActionDescriptor* desc)
{
desc->setValid(isRelevantSelection());
}
The refreshCut method will be called each time the document (and its associated document views) becomes active. Since this may not be sufficient, it is possible to force the checking of the action state by calling the application method refreshAction([Action Name]). In the previous sample, refreshAction(IlvGetSymbol("Cut")) can be invoked, for example, each time the selection changes in the text view.

Version 6.3
Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.