Masking MasterFields/DetailFields
Posted: Thu 23 Oct 2014 13:49
Hello.
I've created my own TVirtualTable descendant, where I need to "redefine" MasterFields and DetailFields properties, among others.
These are published in TVirtualTable and defined in TMemDataSet as protected.
So I redefined them in my descendant /as published/ including my own setters and getters for both.
But their setters and getters didn't work in Object Inspector. After filling any value in design-time, the field was filled back to empty string after click to other property.
So I decided to add one more class, just to hide both properties (state them as private).
So my code looks as follows:
It is working now, but still I can see special property editor for both in Object Inspector.
So is this the right way to redefine/mask published properties and how can I get rid of these editors ?
Thank you for your help.
I've created my own TVirtualTable descendant, where I need to "redefine" MasterFields and DetailFields properties, among others.
These are published in TVirtualTable and defined in TMemDataSet as protected.
So I redefined them in my descendant /as published/ including my own setters and getters for both.
But their setters and getters didn't work in Object Inspector. After filling any value in design-time, the field was filled back to empty string after click to other property.
So I decided to add one more class, just to hide both properties (state them as private).
So my code looks as follows:
Code: Select all
TCustomVirtualTable = class(TVirtualTable)
private
property MasterFields; // Hide published
property DetailFields; // Hide published
end;
TMyVirtualTable = class(TCustomVirtualTable)
private
function GetMasterFields: String;
function GetDetailFields: String;
procedure SetMasterFields(Value: String);
procedure SetDetailFields(Value: String);
published
{ Redefine Hidden Properties }
property MasterFields: String read GetMasterFields write SetMasterFields;
property DetailFields: String read GetDetailFields write SetDetailFields;
end;
So is this the right way to redefine/mask published properties and how can I get rid of these editors ?
Thank you for your help.