[Lazarus] How do you create some kind of type definition based on adding a set if identical functions to different objects with different ancestors?

Frank Church vfclists at gmail.com
Wed Nov 17 11:39:14 CET 2010


I don't know whether interfaces are what I am looking for here.

I am creating an object called TStateInfoSource which needs to display its
state using different objects, mainly a TForm, a TFrame, some future
TComponent based visual object and a  web interface as yet undecided.

eg, both the TForm, the TFrame and web object are to implement a function
called DisplayState in their own way.

Is there some way to create some kind of type definition called a
TImplementsDisplayState so that TStateInfoSource can call the DisplayState
function of  TImplementsDisplayState object it is associated with at
runtime?

In effect the TImplementsDisplayState facility is added or associated with
existing objects, rather then having TForm, TFrame etc as its sub properties
or components. In this way the display code is implemented directly by the
form or frame, rather than having the TImplementsDisplayState object
manipulate the form or frame's elements directly.

In effect is it possible to put a group of unrelated objects into the same
type definition by adding to them a set of identically defined functions?

-- 
Frank Church

=======================
http://devblog.brahmancreations.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20101117/0632ab29/attachment-0002.html>


More information about the Lazarus mailing list