Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DataField Property Editor

96 views
Skip to first unread message

Wesley Lynch

unread,
Aug 8, 2000, 3:00:00 AM8/8/00
to
Hi

I have been working on a data aware component and I thought I was getting it
wrong because the datafield property editor was not working correctly...

This was because I called the "DataField" ... DateField... I did this
because I need three Fields to be associated with the control...

I also saw that the property editor is only used if the Property Name is
DataField so my first thought was to register the property editor again for
my properties....

Question:
1: Can this Re-register approach work..
2: I have been trying an I cannot find the file need is dsdesign.pas -
namely DrpCtrls;

Cut and Pasted from the source...

unit DSDesign;

interface

uses Windows, SysUtils, Messages, Classes, Graphics, Controls,
Forms, StdCtrls, ExtCtrls, DB, DBCtrls, DsgnIntf, LibIntf,
DsnDBCst, DsgnWnds, Menus, DrpCtrls;


Help will be greatly appreciated..

Thanks
Wesley Lynch

Eyder Rios

unread,
Aug 8, 2000, 3:00:00 AM8/8/00
to
Take a look on this code:

Eyder Rios

{ TIBLookupFieldNameProperty }
TIBLookupFieldNameProperty = class(TStringProperty)
public
function GetAttributes: TPropertyAttributes; override;
procedure GetValueList(List: TStrings); virtual;
procedure GetValues(Proc: TGetStrProc); override;
end;


function TIBLookupFieldNameProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paValueList, paSortList, paMultiSelect];
end;

procedure TIBLookupFieldNameProperty.GetValues(Proc: TGetStrProc);
var
I: Integer;
Values: TStringList;
begin
Values := TStringList.Create;
try
GetValueList(Values);
for I := 0 to Values.Count - 1 do
Proc(Values[I]);
finally
Values.Free;
end;
end;

procedure TIBLookupFieldNameProperty.GetValueList(List: TStrings);
var
Instance : TComponent;
PropInfo : PPropInfo;
Database : TIBDatabase;
begin
Instance := TComponent(GetComponent(0));

PropInfo := TypInfo.GetPropInfo(Instance.ClassInfo, 'LookupDatabase');
if (PropInfo <> nil) and (PropInfo^.PropType^.Kind = tkClass) then
begin
if TObject(GetOrdProp(Instance, PropInfo)) is TIBDatabase then
begin
Database := TObject(GetOrdProp(Instance, PropInfo)) as TIBDatabase;
if (Database <> nil) then
begin
PropInfo := TypInfo.GetPropInfo(Instance.ClassInfo, 'LookupTable');
if (PropInfo <> nil) and (PropInfo^.PropType^.Kind = tkLString) then
Database.GetFieldNames (GetStrProp (Instance,PropInfo),List);
end;
end;
end;
end;


Wesley Lynch <lyn...@realmdigital.co.za> escreveu nas notícias de
mensagem:8mprj2$gm...@bornews.borland.com...

Wesley Lynch

unread,
Aug 10, 2000, 3:00:00 AM8/10/00
to
Thanks will give it a look

0 new messages