Solved

How to Create a DB component with FIELD selector

Posted on 2001-09-16
10
262 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
  • 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

816 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

11 Experts available now in Live!

Get 1:1 Help Now