RAD Studio VCL Reference
|
Occurs when an action's Update method is called and its action list has not already handled it.
property OnActionUpdate: TActionEvent;
__property TActionEvent OnActionUpdate;
Use the OnActionUpdate event handler to update the properties of an action when the application is idle if the action's action list does not handle it in an OnUpdate event handler. OnActionUpdate occurs after the OnIdle event.
If the action list that contains the action does not update it in an OnUpdate event handler, the action is routed to the Application object's OnActionUpdate event. The application events object hooks this event and responds with its own OnActionUpdate event handler.
The Handled parameter of the event handler returns false by default. If the handler updates the event, it should change Handled to true, thereby ending the processing of the action. When the event handler exits with Handled set to false, the event first goes to any other application events objects, and then the action's OnUpdate event occurs. If the action is not updated after that, the active control's UpdateAction method is called to allow the target to update the action. Finally, the active form's UpdateAction method is called if all other handlers do not handle the action.
C++ Examples:
/* This example requires a TApplicationEvents and a TListBox in the form. Select the TApplicationEvents, double click on the OnActionUpdate event and add the following code to the handler. Create other TApplicationEvents the same way. When these events update this event is triggered. The Handled parameter of the event handler returns false by default. If the handler handles the event, it should change Handled to true, thereby preventing further attempts to */ void __fastcall TAppEventForm::ApplicationEventsActionUpdate( TBasicAction *Action, bool &Handled) { lbActionUpdate->Items->Add("Event OnActionUpdate"); }
Delphi Examples:
{ This example requires a TApplicationEvents and a TListBox in the form. Select the TApplicationEvents, double click on the OnActionUpdate event and add the following code to the handler. Create other TApplicationEvents the same way. When these events update this event is triggered. The Handled parameter of the event handler returns false by default. If the handler handles the event, it should change Handled to true, thereby preventing further attempts to handle the action. } procedure TMainForm.ApplicationEventsActionUpdate(Action: TBasicAction; var Handled: Boolean); begin lbActionUpdate.Items.Add('Event OnActionUpdate'); end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|