Solved

property editor for databasename

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending Gmail through Delphi 3 108
find a node in VST 2 68
QRReport  TQrmemo vertical stretching 1 46
Firemonkey allowing RTL on android 6 32
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

773 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