Unit 'MUIClass.List' Package
[Overview][Types][Classes][Index] [#MUIClass]

TMUIList.OnConstruct

Constrcut a new List Entry

Declaration

Source position: MUIClass.List.pas line 129

published property TMUIList.OnConstruct : TConstructEvent
  read FOnConstruct
  write SetOnConstruct;

Description

The construct event is called whenever you add an entry to your list. MUI will not insert the given pointer directly, but instead call the construct hook and add its result code.

Imagine you want to display a list of entries in a directory. You could step through it using Examine()/ExNext() and directly use the Insert() method on your file info block buffer.

Your construct event will be called with this file info block as parameter, makes a copy of it and returns the address of that copy. Thats what is actually added to the list.

The corresponding destruct hook is called whenever an entry shall be removed. It's task would simply be to free the memory and maybe other resources concering this entry that were allocated by the construct event.

Using these two functions, you will never have to worry about freeing the memory used by your list entries. Clearing the list or disposing the list object will automatically remove all entries and thus free the associated resources.

If the construct Event returns Nil, nothing will be added to the list.

There is a builtin construct Event available (do not connect this Event or set to nil). This expects that you only add strings to your list and will make a local copy of this string to allow you destroying the original. Of course you must also not connect the Destruct Event in this case.

See also

OnDestruct

  

Destroy an Entry which is removed from the List

OnDisplay

  

Define what should be printed in a list row


Documentation generated on: 2024-12-22