Solved

property editor for databasename

Posted on 2000-05-18
3
204 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

932 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now