Horacio Jamilis wrote:
so, I can use... mylinkedproperty.obj.[prop] ... beeing [prop] any
property of the object that is of class LinkedObjectClass, and avoiding
to type TMyLinkeddObjectClass(mylinkedproperty.obj).[prop] ???
You can define TMyLinkeddObjectClass and override the property types so
casting is only done in that class's implementation. All your instances
of TMyLinkeddObjectClass doesn't have to do casting then.
eg:
// you base class of your OPF framework.
TtiObjectList = class(TtiObject)
private
protected
function GetItems(i: integer): TtiObject; virtual;
procedure SetItems(i: integer; const Value: TtiObject); virtual;
public
property Items[i:integer]: TtiObject read GetItems write SetItems;
function Add(const AObject: TtiObject): integer; virtual;
published
end;
// Your custom object list class which defines correct class types
TMyLinkeddObjectClassList = class(TtiObjectList)
private
protected
function GetItems(i: integer): TMyLinkeddObjectClass; reintroduce;
procedure SetItems(i: integer; const Value:
TMyLinkeddObjectClass); reintroduce;
public
property Items[i:integer]: TMyLinkeddObjectClass read GetItems
write SetItems;
function Add(const AObject: TMyLinkeddObjectClass): integer;
reintroduce;
published
end;
Regards,
- Graeme -
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal