0

I'm writing a VCL component that needs to connect to a database and perform operations there. To support this, I've added a string property for an ADO connection string:

private
   pconnectionstring : string;
published
   property ConnectionString : string read pconnectionstring write SetConnectionString; 

But, I want to allow a developer using my component to generate the connection string in the object inspector, by pressing the "three dots" button, so that the ADO connection string dialog appears, and the developer can generate a connection string, the way it is implemented in the Delphi IDE when you use the ADO components. How do I do this?

Vector
  • 10,879
  • 12
  • 61
  • 101
Tracer
  • 2,544
  • 2
  • 23
  • 58

1 Answers1

1

You are asking about how to implement design-time property editors, which requires just a bit of work, although it's not by no means rocket science. A google search will give you plenty of information. The Dr. Bob I site I linked to is a good resource.

Another good place (among many) to start might be: Delphi Property Editors - An Introduction

The Embarcadero Developer Network sometimes has good information as well, although often enough (perhaps too often...), other sites are better.

Vector
  • 10,879
  • 12
  • 61
  • 101
  • As I can see, design-time property editors require dsgnintf package. But, there is no 64 bit version of dsgnintf. So, I shouldn't use design-time property editors if I want my component to work for both 32 & 64 bit? – Tracer Jul 04 '14 at 12:20
  • I don't use the 64 bit compiler, if that's what you mean, so I can't tell you about that - others can. But all your 32 bit code and applications will run fine on a 64 bit machine - Win64 has built in automatic 32 bit support. I have been developing with Delphi XE 32 for several years on all 64 bit platforms: Development, workstations and server deployments - no problems at all. It seems very unlikely that you can't implement design time property editors in a 64 bit environment - that doesn't sound right. – Vector Jul 04 '14 at 12:49
  • I know that the code will run fine but I'm not able to compile the package for x64 platform when dsnintf is required. Investigating a bit I discovered dsgnintf does not exist for x64 platform and cannot proceed further. – Tracer Jul 04 '14 at 13:17
  • You must separate design-time from runtime. Your design package only needs to be 32-bit to work in the IDE. Your component code should be in a separate (runtime) package. – Ondrej Kelle Jul 04 '14 at 14:06
  • 1
    To elaborate on that, the design-time editors are only 32bit because the IDE is only 32bit, there's no 64bit design-time editors because there's no 64bit IDE. – Jerry Dodge Jul 04 '14 at 14:10
  • @TOndrej I heard that before somewhere but I'm not sure how to do that. Is there a tutorial somewhere that demonstrates that? – Tracer Jul 04 '14 at 18:12
  • @Tracer - maybe you should post a new question that reflects your 32/64 bit problems when implementing design-time property editors. – Vector Jul 04 '14 at 22:53
  • 1
    @Tracer Yes, read the [Component Writer's Guide](http://docwiki.embarcadero.com/RADStudio/XE6/en/Component_Writer%27s_Guide_Index). – Ondrej Kelle Jul 07 '14 at 06:15