Unit 'MUIClass.Base' Package
[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] [#MUIClass]

TMUIRootClass.ConnectHook

Connect a Event (via Hook) to a changing Field Value with internal object

Declaration

Source position: MUIClass.Base.pas line 78

protected procedure TMUIRootClass.ConnectHook(

  MUIField: PtrUInt;

  TriggerValue: PtrUInt;

  HookFunc: THookFunc

);

Arguments

MUIField

  

Field to Trigger

TriggerValue

  

Value when the Event should be fired or MUIV_EveryTime trigger for every change

HookFunc

  

Event function to call when event is triggered

Description

Set the Hook to the Hook function and install a Notify Event for the given Field and Value. The Hook Data points to this Pascal object. in principle it does something like:

MH_SetHook(Hook, HookFunc, Self);
  DoMethod(MUIObj, [MUI_Notify, MUIField, TriggerValue, MUIV_Notify_Self, 2, MUIM_CallHook, NativeUInt(Hook)]);
  

Best place to use that is inside AfterCreateObject.

Example:

function PressFunc(Hook: PHook; Obj: Object: Pointer): PtrInt;
var
  PasObj: TMUIArea;
begin
  Result := 0;
  PasObj := TMUIArea(Hook^.h_Data);
  writeln('Got a click event of Object ', PasObj.Classname);
end;

// in AfterCreateObject() connect the Event
ConnectHook(MUIA_Pressed, MUI_FALSE, @PressFunc);

See also

AfterCreateObject

  

Connect Events to the object


Documentation generated on: 2024-12-22