Solved

Properties don't work when I import ActiveForm into Delphi as ActiveX

Posted on 2001-07-02
11
329 Views
Last Modified: 2010-05-18
Please tell me what I am doing wrong!

I am attempting to create some general purpose ActiveX controls, using Delphi ActiveForms.

I add lots of properties and events, and they appear correctly when I use them inside VB, IE etc.

However, when I import one as an ActiveX control to use in Delphi itself (I know you wouldn't normally do that), the properties appear in the object inspector list ok, but are not saved when the form is saved. (i.e. all of the published properties in the _TLB file have "stored false" next to them). Oddly, the assigned events get saved ok.

This means that the poor delphi programmer has to programmatically set the properties before he can use my ActiveX control.

I give lots of points for this, because I just need someone to try doing the same thing to see if they can make it work, or if Delphi is just being rubbish in not supporting its own standard.

I know I could create my controls as VCL components, convert to ActiveX and then publish both .ocx and .bpl versions of my controls.

But I don't want to do this because:
a) ActiveForms are much easier and quicker for me to create
b) I don't want to publish two different versions of my software, depending on the platform.

Any help most appreciated.
0
Comment
Question by:JLANE
  • 3
  • 2
  • 2
  • +4
11 Comments
 
LVL 6

Expert Comment

by:edey
ID: 6245481
Following

GL
Mike
0
 
LVL 14

Expert Comment

by:AvonWyss
ID: 6245549
Why are the properties set to "stored false"? As far as I undertant it, it tells Delphi not to safe these properties to disk. So it would make perfect sense why you can see and modify them but they are not saved. I think the solution will lie somewhere in the declaration of your ActiveX control.
0
 

Author Comment

by:JLANE
ID: 6249251
AvonWyss:
If I knew why I get "stored false" my problem would be solved!

This is the information that I seek: how do I configure my ActiveX control such that when it is imported into Delphi I get "stored true" instead of "stored false" next to all of my properties.


0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
LVL 14

Expert Comment

by:AvonWyss
ID: 6249393
Open then Delphi Help Index, and enter: "ActiveX-Controls", scroll down until you get something like "Declaring properties as published", and open this page (since I have an international version of Delphi, I don't know the exact terms used). Therte are some explanations regarding the nonpersitance. However, I'm not sure it's going to help you, but who knows; check it out.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6261806
You need to implement the IPersistPropertyBag methods. Search on Google for 'Delphi IPersistPropertyBag'.
0
 

Author Comment

by:JLANE
ID: 6265023
Epsylon:
Thanks for the reply.

I tried to implement IPersistPropertyBag as you suggested. I did everything in the examples, but it needed to me to implement "GetClassId" which wasn't described anywhere.
I implemented it as follows:

function TMyControlX.GetClassId(out classID: TCLSID): HResult;
begin
  classID := ActiveFormControl.Factory.ClassID;
  Result := S_OK;
end;

My control still does not persist in Delphi.

As I was looking through the VCL source, I noticed that TActiveForm.ActiveFormControl already implements IPersistPropertyBag. It enumerates through all of the controls in the form saving and loading them (as you might expect).

When looking through the net, it seemed to me that the orriginal problem was in Delphi 3 and subsequently resolved with a patch. I'm using Delphi 5 so I'm not sure that your advice is correct.

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 6265089
First I have to tell that I have never done it...

As far as I know TActiveForm.ActiveFormControl only takes care of the default properties, events, etc. Not the custom ones.
0
 

Author Comment

by:JLANE
ID: 6265170

Yes, it is odd the way it remembers all of the events but not the custom properties.





0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 6932044
Hopefully you've already been helped with this question, but thought you'd appreciate knowing this.  It would be great if you could bring this question to a conclusion, awarding the experts above who helped you with points or a comment to them on your status today.

WindowsUpdate has new updates for .NET users; Details follow - Microsoft .NET Framework
The .NET Framework is a new feature of Windows. Applications built using the .NET Framework are more reliable and secure. You need to install the .NET Framework only if you have software that requires it.

For more information about the .NET Framework, see http://www.microsoft.com/net. (This site is in English.)

System Requirements
The .NET Framework can be installed on the following operating systems:
Windows 98
Windows 98 Second Edition (SE)
Windows Millennium Edition (Windows Me)
Windows NT 4.0® (Workstation or Server) with Service Pack 6.0a
Windows 2000 with the latest service pack installed (Professional, Server, Datacenter Server, or Advanced Server)
Windows XP (Home Edition and Professional)
You must be running Internet Explorer version 5.01 or later for all installations of the .NET Framework.

To install the .NET Framework, your computer must meet or exceed the following software and hardware requirements:

Software requirements for server operating systems:
MDAC 2.6
Hardware requirements:
For computers running only a .NET Framework application, Pentium 90 mHz CPU with 32 MB memory or the minimum CPU and RAM required by the operating system, whichever is higher.
For server operating systems, Pentium 133 mHz CPU with 128 MB memory or the minimum CPU and RAM required by the operating system, whichever is higher.
Recomended software:
MDAC 2.7 is recommended.
Recommended hardware: For computers running only a .NET Framework application, Pentium 90 MHz CPU with 96 MB memory or the minimum CPU and RAM required by the operating system, whichever is higher.
For server operating systems, Pentium 133 MHz CPU with 256 MB memory or the minimum CPU and RAM required by the operating system, whichever is higher.

How to use -> Restart your computer to complete the installation. No other action is required to run .NET Framework applications. If you are developing applications using the .NET Framework, you can use the command-line compilers or you can use a development environment, such as Visual Studio .NET, that supports using the .NET Framework.

How to uninstall
To uninstall the .NET Framework: Click Start, point to Settings, and then click Control Panel (In Windows XP, click Start and then click Control Panel.).
Click Add/Remove Programs.
Click Microsoft .NET Framework (English) v1.0.3705 and then click Change/Remove.
More here  http://www.microsoft.com/net/

The .NET topic is being considered for addition to our All Topics link soon, so this may interest you as well:
http://www.experts-exchange.com/newtopics/Q.20276589.html

EXPERTS POINTS are waiting to be claimed here:  http://www.experts-exchange.com/commspt/Q.20277028.html

":0)
Asta


0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8701520
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

To be PAQ/Refund

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 8816874
PAQ'ed and points not refunded,

PashaMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
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…

808 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