Solved

property editor for databasename

Posted on 2000-05-18
3
210 Views
Last Modified: 2010-04-04
Hi,
How can I do a databasename property editor for my component ? In D3 ;)
It's not a dataaware component.
I want the same editor the for any tdataset component.
I want to be able to choose the database name that I'm going to work on.

Thank for the helps..
0
Comment
Question by:jeurk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
ITugay earned 76 total points
ID: 2820646
Hi jeurk,

It must work for you like for me. If you need additional info let me know.


type
  TDatabaseNameProperty = class(TStringProperty)
  public
    function  GetAttributes: TPropertyAttributes; override;
    procedure GetValues(Proc: TGetStrProc); override;
  end;


// !!! Change it
// !!! TYourComponentClass
// !!! 'DatabaseName'
procedure Register;
begin
  RegisterPropertyEditor(TypeInfo(string), TYourComponentClass, 'DatabaseName', TDatabaseNameProperty);
end;

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

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

------
Igor
0
 
LVL 9

Expert Comment

by:ITugay
ID: 2820649
jeurk,

do not forget

uses ...., DsgnIntf, ....
----
Igor.
0
 
LVL 4

Author Comment

by:jeurk
ID: 2821047
Ok, thanks it's working perfectly.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question