THYControl

Overview

The THYControl base class for user interface controls implements the IHYControl interface and provides access to standard properties like Action, Index and Caption. In the Hydra framework, the THYControl class is used as a base class for all menu and toolbar items.

You should not use this class directly, to access control properties, you can use the IHYControl interface or one of its descendants. For example:

procedure TTextEditorPlugin.HYPluginControlsRepository1AfterMergeMenuItems(
  Sender: THYPluginControlsRepository; const aHost: IHYHost;
  const anUpdateID: TGUID);
var
  //IHYMenuItem inherits from IHYControl
  FileMenu : IHYMenuItem;
begin
  if (Host.MenuController=NIL) then Exit;

  FileMenu := Host.MenuController.Items.MenuItemByCaption('File');
  FileMenu.Caption := 'New Caption';
end;

Location


 

constructor Create (TObject, THYBaseController)  reintroduce virtual

Creates a new instance of the class.

constructor Create(anObject: TObject; aController: THYBaseController)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • aController: References to a controller that is used to manage this control.

constructor Create (TObject, Boolean)  reintroduce virtual    (declared in THYObjectReference)

Creates a new instance of the class.

constructor Create(anObject: TObject; OwnsObject: Boolean)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • OwnsObject: If set to true, the referenced object will be freed when this class is destroyed.

Controller

References to a controller that is used to manage this control.

property Controller: THYBaseController read write

DestroyObject  protected    (declared in THYObjectReference)

Destroys the referenced object.

procedure DestroyObject

DoGetIndex  protected virtual abstract

Returns an item index from the underlying control.

function DoGetIndex: Integer

GetAction  protected dynamic

Gets an action associated with underlying control.

function GetAction: TBasicAction

GetCaption  protected dynamic

Gets caption of the underlying control.

function GetCaption: string

GetIndex  protected dynamic

Gets an item index from the underlying control.

function GetIndex: Integer

GetProperty  protected    (declared in THYObjectReference)

Retrieves the value of the published property of the referenced object.

function GetProperty(const aName: string): variant

Parameters:

  • aName: Name of the property.

GetRefObject  protected    (declared in THYObjectReference)

Gets referenced object.

function GetRefObject: TObject

SetAction  protected dynamic

Sets an action associated with underlying control.

procedure SetAction(Value: TBasicAction)

Parameters:

  • Value: Reference to an action.

SetCaption  protected dynamic

Sets caption of the underlying control.

procedure SetCaption(const Value: string)

Parameters:

  • Value: New value of the caption.

SetProperty  protected    (declared in THYObjectReference)

Sets the value of the published property of the referenced object.

procedure SetProperty(const aName: string; const aPropertyValue: variant)

Parameters:

  • aName: Name of the property.
  • aPropertyValue: Value of the property.

 

Controller

References to a controller that is used to manage this control.

property Controller: THYBaseController read write

 

constructor Create (TObject, THYBaseController)  reintroduce virtual

Creates a new instance of the class.

constructor Create(anObject: TObject; aController: THYBaseController)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • aController: References to a controller that is used to manage this control.

constructor Create (TObject, Boolean)  reintroduce virtual    (declared in THYObjectReference)

Creates a new instance of the class.

constructor Create(anObject: TObject; OwnsObject: Boolean)

Parameters:

  • anObject: Object that is wrapped by this class, if anObject is nil, an EHYException is raised.
  • OwnsObject: If set to true, the referenced object will be freed when this class is destroyed.

DestroyObject  protected    (declared in THYObjectReference)

Destroys the referenced object.

procedure DestroyObject

DoGetIndex  protected virtual abstract

Returns an item index from the underlying control.

function DoGetIndex: Integer

GetAction  protected dynamic

Gets an action associated with underlying control.

function GetAction: TBasicAction

GetCaption  protected dynamic

Gets caption of the underlying control.

function GetCaption: string

GetIndex  protected dynamic

Gets an item index from the underlying control.

function GetIndex: Integer

GetProperty  protected    (declared in THYObjectReference)

Retrieves the value of the published property of the referenced object.

function GetProperty(const aName: string): variant

Parameters:

  • aName: Name of the property.

GetRefObject  protected    (declared in THYObjectReference)

Gets referenced object.

function GetRefObject: TObject

SetAction  protected dynamic

Sets an action associated with underlying control.

procedure SetAction(Value: TBasicAction)

Parameters:

  • Value: Reference to an action.

SetCaption  protected dynamic

Sets caption of the underlying control.

procedure SetCaption(const Value: string)

Parameters:

  • Value: New value of the caption.

SetProperty  protected    (declared in THYObjectReference)

Sets the value of the published property of the referenced object.

procedure SetProperty(const aName: string; const aPropertyValue: variant)

Parameters:

  • aName: Name of the property.
  • aPropertyValue: Value of the property.

 

Implements

 

  • IHYControl