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

THookList

[Properties (by Name)] [Methods (by Name)] [Events (by Name)]

A List of Hooks, wich will be automatically destroyed on exit

Declaration

Source position: MUIClass.Base.pas line 27

type THookList = class

public

  constructor Create; virtual;

  

Create a new Hooklist

  destructor Destroy; override;

  

Destroy List, all Hooks are freed before

  function GetNewHook;

  

Get a new Hook, and add it to List

  procedure RemoveHook();

  

Hook is not needed anymore, remove it from list, Hook is freed

end;

Inheritance

THookList

  

A List of Hooks, wich will be automatically destroyed on exit

|

TObject

Description

Often you need to instance Hooks, and keep the Hook pointer, but you don't actually need the Hook itself (just the memory should be remembered). The easiest way is to use this class for bookkeeping opened Hooks.

Example:

var
  Hook: PHook;
begin
  Hook := HookList.GetNewHook;        // get a new Hook Pointer
  MH_SetHook(Hook^, PressFunc, Self); // set the Hook fields
  //Connect the Hook to the Pressed property of Area
  DoMethod(ButtonObj, [MUIM_Notify, MUIA_Pressed, AsTag(False), AsTag(AObj), 2, MUIM_CallHook, AsTag(Hook)]);
  // you do not need to keep the Hook anymore, it will be destroyed on HookList.destroy
end;

Documentation generated on: 2022-07-30