Solved

property editor for databasename

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

705 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

19 Experts available now in Live!

Get 1:1 Help Now