Solved

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

Posted on 2001-07-02
11
331 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
[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
  • 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
Industry Leaders: 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 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

Industry Leaders: 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!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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