Solved

How to Create a DB component with FIELD selector

Posted on 2001-09-16
10
265 Views
Last Modified: 2010-04-06
Hi, I want to create a DB component where I select the Datasource. That works correctly, but when I want to select the FIELD (TFIELD) I get a list of ALL fields. I only want to have the fields from the source I've selected in the object inspector.

Anyone knows How?
0
Comment
Question by:Avataris
[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
  • 6
  • 4
10 Comments
 
LVL 8

Accepted Solution

by:
TOndrej earned 100 total points
ID: 6485749
Have a look in DBReg unit...

RegisterPropertyEditor(TypeInfo(string), TComponent, 'DataField', TDataFieldProperty);

This means that TDataFieldProperty property editor is registered for all string properties called 'DataField' of all TComponent descendants.

I guess your component is a TComponent descendant <g>.
Is your property of type string?
Is it called 'DataField'?

IOW, does the declaration look similar to the following:

property DataField: string read GetDataField write SetDataField;

??

Please be more specific, and show us how the property is declared and any other info you think might be useful.
From the symptoms you describe it seems that your property is of type TField... but I don't want to guess for no good reason.

TOndrej
0
 

Author Comment

by:Avataris
ID: 6485759
Yes the property is declared like that, I want to have a combobox with the fields from the table in the property editor.
0
 

Author Comment

by:Avataris
ID: 6485762
I don't have a DBREG anything :(
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:TOndrej
ID: 6485763
Please show me the exact declaration and get/set methods and the internal field declaration.
0
 

Author Comment

by:Avataris
ID: 6485767
But I think i get your point :)
I'll test it now.
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 6485772
I have it in <delphidir>\Source\Property Editors\dbreg.pas
(Delphi 5 Enterprise)
0
 

Author Comment

by:Avataris
ID: 6485776
Thanx, this method :

RegisterPropertyEditor(TypeInfo(string), TComponent, 'DataField', TDataFieldProperty);


Is all I needed :)
0
 
LVL 8

Expert Comment

by:TOndrej
ID: 6485779
It's strange that you needed it.

Anyway... You don't seem to be interested in a complete solution. Good luck.
0
 

Author Comment

by:Avataris
ID: 6486011
Thanx, this method :

RegisterPropertyEditor(TypeInfo(string), TComponent, 'DataField', TDataFieldProperty);


Is all I needed :)
0
 

Author Comment

by:Avataris
ID: 6486016
I don't have Delphi 5, just Delphi 4.
Delphi 4 has no examples about the subject.
Complete solutions take the fun of programming away ;)

But my component works fine now :)
Thanks!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

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…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
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…

752 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