Please enable JavaScript to view this site.

KOL/MCK - User Guide

TAction = object( TObj )

Use action objects, in conjunction with action lists, to centralize the response to user commands (actions).

Use AddControl, AddMenuItem, AddToolbarButton methods to link controls to an action.

See also TActionList.

 

TActionList = object( TObj )

TActionList maintains a list of actions used with components and controls, such as menu items and buttons.

Action lists are used, in conjunction with actions, to centralize the response to user commands (actions).

Write an OnUpdateActions handler to update actions state.

Created using function NewActionList.

See also TAction.

 

type PControlRec = ^TControlRec;

 

type TOnUpdateCtrlEvent = procedure(Sender: PControlRec) of object;

 

type TCtrlKind = (ckControl, ckMenu, ckToolbar);

 

type TControlRec = record

   Ctrl: PObj;

   CtrlKind: TCtrlKind;

   ItemID: integer;

   UpdateProc: TOnUpdateCtrlEvent;

end;

 

PAction = ^TAction;

 

PActionList = ^TActionList;

 

 

Constructors:

 

function NewAction(const ACaption, AHint: KOLString; AOnExecute: TOnEvent): PAction;

 

function NewActionList(AOwner: PControl): PActionList;

Action list constructor. AOwner - owner form.

 

 

TAction and TActionList properties

 

property Caption: KOLString;

Text caption.

 

property Hint: KOLString;

Hint (tooltip). Currently used for toolbar buttons only.

 

property Checked: boolean;

Checked state.

 

property Enabled: boolean;

Enabled state.

 

property Visible: boolean;

Visible state.

 

property HelpContext: integer;

Help context.

 

property Accelerator: TMenuAccelerator;

Accelerator for menu items.

 

property Actions[Idx: integer]: PAction;

Access to actions in the list.

 

property Count: integer;

Number of actions in the list..

 

 

TAction and TActionList methods

 

destructor Destroy; virtual;

 

procedure LinkControl(Ctrl: PControl);

Add a link to a TControl or descendant control.

 

procedure LinkMenuItem(Menu: PMenu; MenuItemIdx: integer);

Add a link to a menu item.

 

procedure LinkToolbarButton(Toolbar: PControl; ButtonIdx: integer);

Add a link to a toolbar button.

 

procedure Execute;

Executes a OnExecute event handler.

 

function Add(const ACaption, AHint: KOLString; OnExecute: TOnEvent): PAction;

Add a new action to the list. Returns pointer to action object.

 

procedure Delete(Idx: integer);

Delete action by index from list.

 

procedure Clear;

Clear all actions in the list.

 

 

TAction and TActionList events

 

property OnExecute: TOnEvent;

This event is executed when user clicks on a linked object or Execute method was called.

 

property OnUpdateActions: TOnEvent;

Event handler to update actions state. This event is called each time when application goes in the idle state (no messages in the queue).

 

KOL / MCK User Guide - Created by Carl Peeraer - Diamant Soft, based on the work of Vladimir Kladov - Artwerp.be

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Nav Header: ALT+n
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Exit Menu/Up: ESC