出现对话框的是“组件编辑器”,是用“属性编辑器”,
procedure Register;
begin
RegisterComponents('苏源高科', [TSYDBNavigator]);
RegisterPropertyEditor(TypeInfo(string),TSYDBNavigator,'UpdateTable',TUpdateProperty);
end;
function TUpdateProperty.GetAttributes:TPropertyAttributes;
begin
Result:=[paDialog,paValueList,paSortList];
end;
procedure TUpdateProperty.GetValues(Proc:TGetStrProc);
var
i:integer;
begin
if not FLink.Active then Exit;
session.GetTableNames(TDBDataSet(FLink.DataSet).databasename,'',false,false,tbList);
if FLink.DataSet is TTable then Proc(TTable(FLink.DataSet).Tablename)
else if FLink.DataSet is TQuery then begin
for i:=0 to tbList.Count-1 do
if Pos(Lowercase(TbList),LowerCase(TQuery(FLink.DataSet).Sql.Text))>0 then
Proc(TbList);
end;
end;
TUpdateProperty=class(TStringProperty)
public
function GetAttributes:TpropertyAttributes;override;
procedure GetValues(Proc:TGetStrProc);override;
end;