unit frxIBXEditor;interface{$I frx.inc}implementationuses  Windows, Classes, SysUtils, Forms, Dialogs, frxIBXComponents, frxCustomDB,  frxDsgnIntf, frxRes, IBDatabase, IBTable{$IFDEF Delphi6}, Variants{$ENDIF};type  TfrxDatabaseNameProperty = class(TfrxStringProperty)  public    function GetAttributes: TfrxPropertyAttributes; override;    function Edit: Boolean; override;  end;  TfrxTableNameProperty = class(TfrxStringProperty)  public    function GetAttributes: TfrxPropertyAttributes; override;    procedure GetValues; override;  end;  TfrxIndexNameProperty = class(TfrxStringProperty)  public    function GetAttributes: TfrxPropertyAttributes; override;    procedure GetValues; override;  end;{ TfrxDatabaseNameProperty }function TfrxDatabaseNameProperty.GetAttributes: TfrxPropertyAttributes;begin  { this property possesses  editor }  Result := [paDialog];end;function TfrxDatabaseNameProperty.Edit: Boolean;var  SaveConnected: Bool;  db: TIBDatabase;begin  { get link to TfrxIBXDatabase.Database }  db := TfrxIBXDatabase(Component).Database;  { create standard OpenDialog }  with TOpenDialog.Create(nil) do  begin    InitialDir := GetCurrentDir;    { we are interested in *.gdb files }    Filter := frxResources.Get('ftDB') + ' (*.gdb)|*.gdb|' + frxResources.Get('ftAllFiles') + ' (*.*)|*.*';    Result := Execute;    if Result then    begin      SaveConnected := db.Connected;      db.Connected := False;      { if dialogue is completed successfully, assign new DB name }      db.DatabaseName := FileName;      db.Connected := SaveConnected;    end;    Free;  end;end;{ TfrxTableNameProperty }function TfrxTableNameProperty.GetAttributes: TfrxPropertyAttributes;begin  {  property represents list of values }  Result := [paMultiSelect, paValueList];end;procedure TfrxTableNameProperty.GetValues;var  t: TIBTable;begin  inherited;  { get link to  TIBTable  component }  t := TfrxIBXTable(Component).Table;  { fill list of tables available }  if t.Database <> nil then    t.DataBase.GetTableNames(Values, False);end;{ TfrxIndexProperty }function TfrxIndexNameProperty.GetAttributes: TfrxPropertyAttributes;begin  {  property represents list of values }  Result := [paMultiSelect, paValueList];end;procedure TfrxIndexNameProperty.GetValues;var  i: Integer;begin  inherited;  try    { get link to TIBTable component }    with TfrxIBXTable(Component).Table do      if (TableName <> '') and (IndexDefs <> nil) then      begin        { update indexes }        IndexDefs.Update;        { fill list of indexes available }        for i := 0 to IndexDefs.Count - 1 do          if IndexDefs[i].Name <> '' then            Values.Add(IndexDefs[i].Name);      end;  except  end;end;initialization  frxPropertyEditors.Register(TypeInfo(String), TfrxIBXDataBase, 'DatabaseName', TfrxDataBaseNameProperty);  frxPropertyEditors.Register(TypeInfo(String), TfrxIBXTable, 'TableName', TfrxTableNameProperty);  frxPropertyEditors.Register(TypeInfo(String), TfrxIBXTable, 'IndexName', TfrxIndexNameProperty);end.

如果您对 FastReport 感兴趣,欢迎加入 FastReport QQ 交流群:702295239

还想要更多吗可以点击阅读【FastReport 表2021最新资源盘点】查找需要的教程资源。上是FastReport .NET慧正在 火热销售中!>>查看价格详情

标签:

声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2021年6月19日
下一篇 2021年6月19日

相关推荐

发表回复

登录后才能评论