Solved

How to Create a DB component with FIELD selector

Posted on 2001-09-16
10
258 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
 
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

760 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

21 Experts available now in Live!

Get 1:1 Help Now