TSetting =
class
private
FVarName :
String;
FDefaultText :
String;
FDefaultTextDisplayName :
String;
FTitle :
String;
FDescription :
String;
FValueLabel :
String;
// Im SQL-Text enthaltender Text
procedure setVarName(s :
String);
function getVarName() :
String;
procedure setDefaultText(s :
String);
function getDefaultText() :
String;
procedure setTitle(s :
String);
function getTitle() :
String;
procedure setDescription(s :
String);
function getDescription() :
String;
procedure setValueLabel(s :
String);
function getValueLabel() :
String;
function getDefaultTextDisplayName() :
String;
procedure setDefaultTextDisplayName(s :
String);
published
[Description('
VarName'), System.ComponentModel.Browsable(true), DisplayName('
Hallo')]
property VarName :
String read getVarName
write setVarName;
//////////////////////////////////////
[PropertyAttributesProvider('
DynamicPropertyAttributesProvider'), System.ComponentModel.Browsable(true)]
property DefaultText :
String read getDefaultText
write setDefaultText;
[System.ComponentModel.Browsable(true)]
property defaultTextDisplayName :
String read getDefaultTextDisplayName
write setDefaultTextDisplayName;
////////////////////////////////////////
[System.ComponentModel.Browsable(true)]
property Title :
String read getTitle
write setTitle;
[System.ComponentModel.Browsable(true)]
property Description :
String read getDescription
write setDescription;
[System.ComponentModel.Browsable(true)]
property ValueLabel :
String read getValueLabel
write setValueLabel;
public
procedure DynamicPropertyAttributesProvider(
var attributes : PropertyAttributes);
end;
{...}
procedure TSetting.DynamicPropertyAttributesProvider(
var attributes : PropertyAttributes);
begin
attributes.DisplayName := defaultTextDisplayName;
// attributes.IsReadOnly := dynamicPropertyIsReadOnly;
// attributes.IsBrowsable := dynamicPropertyIsVisible;
end;
{...}
{PropertyGrid erzeugen usw.}
constructor TSqlVarFrm.Create;
begin
inherited Create;
InitializeComponent;
propertyGrid := FormsUtils.CustomPropertyGrid.Create;
// statusBarEx := FormsUtils.StatusBarEx.Create;
propertyGrid.CommandsVisibleIfAvailable := true;
propertyGrid.ExpandOnTab := false;
propertyGrid.LargeButtons := false;
propertyGrid.LineColor := System.Drawing.SystemColors.ScrollBar;
propertyGrid.Location := System.Drawing.Point.Create(0, 48);
propertyGrid.
Name := '
propertyGrid';
propertyGrid.Size := System.Drawing.Size.Create(456, 272);
propertyGrid.TabIndex := 3;
propertyGrid.Text := '
customPropertyGrid1';
propertyGrid.ViewBackColor := System.Drawing.SystemColors.Window;
propertyGrid.ViewForeColor := System.Drawing.SystemColors.WindowText;
propertyGrid.Dock := DockStyle.Fill;
propertyGrid.Parent := self;
FSqlVar := TSetting.Create;
FSqlVar.VarName := '
Var';
FSqlVar.DefaultText := '
Default';
FSqlVar.Title := '
Titel';
FSqlVar.Description := '
Desc';
FSqlVar.ValueLabel := '
Label';
FSqlVar.defaultTextDisplayName := '
Hallo Welt';
PropertyGrid.SelectedObject := FSqlVar;
propertyGrid.Refresh;