类型
TDataBaseName = String;属性
DatabaseName:TDataBaseName;熟悉编辑器
TDataBaseNameEditor = Class(TStringProperty)
  public
      
      procedure GetNames(Name :TStrings);
      function  GetAttributes:TPropertyAttributes;override;
      procedure  GetValues(proc:TGetStrProc);override;
  end;procedure Register;
begin
 RegisterPropertyEditor(TypeInfo(TDataBaseName), TTableBox,'DataBaseName', TDataBaseNameEditor);
end;procedure TDataBaseNameEditor.GetNames( Name: TStrings);
begin
  Session.GetDataBaseNames(Name);
end;function TDataBaseNameEditor.GetAttributes: TPropertyAttributes;
begin
  result := [paMultiselect,paSortList, paValueList];
end;procedure TDataBaseNameEditor.GetValues(proc: TGetStrProc);
var
 i:integer;
 strings:TStrings;
begin
  Strings := TStringList.Create;
  try
     GetNames( Strings );
     ShowMessage('hha');
     for I := 0 to Strings.Count - 1 do Proc( Strings[I] );
  finally
    Strings.Free;
  end;
end;
这样写行不行,我的databasename 没有下拉框.

解决方案 »

  1.   

    应该是可以的。除非你注册的代码写错了。
    在{$Delphi}\Source\Property Editors下面的dbreg.pas,有很多例子,你可以参考一下。
      

  2.   

    1.你没有定义property
    2.要放在published域内
    3.chechy老大说的
      

  3.   

    感觉你应该重载那个作为参数传递的GetStrProc(它应该已经被声明了的),而不是GetValues。
      

  4.   

    学习ing———……
    努力学习,争取早日成为 星
      

  5.   

    to older(疲倦的程序员) 
    枚举行是什么意思,人家是动态的啊,枚举是固定的啊,说说你的看法
      

  6.   

    RegisterPropertyEditor(PropertyType: PTypeInfo; ComponentClass: TClass; const PropertyName: string; EditorClass: TPropertyEditorClass);写起来太麻烦你自己看一些控件代码吧