Problem when creating components.

I'm having some trouble creating components in Delphi3.
I'm trying to write a component that has a derived class of TComponentEditor. Everything complies ok. But when I drag the component onto a Form and try to access the component's editor through the popup menu I get an access violation error.
And I'm doing everything right and even tried the "copy-paste from delphi books" method. ;)
I'm using the Delphi 3.0 Professional version not the 3.01 version. Is there any difference between those versions ???
I have programmed in Delphi for several years now but reacently started to create my own components.

HI, Tomas,
Send you codes I promised to send.
You can compare what I wrote with what you have and I hope you
will find your error.
unit EdcStrings;
{---------------------------------------------------------------------}

HI, TomasHelgi,
It's not so easy to find the error in your code without
your code. But from what you say check the following:
1. In implementation of the ExecuteVerb of your Editor
did you CREATE the Dialog form (your Editor form).
2. When you call the COMPONENT's Owner.Name and Name did you do that correctly.
3. When you read the properties of your component into the Editor, did you do the type conversion.

And did you at all test your Editor as a usual form which changes the properties of your component?
Sincerely,
Nestorua.

Well, I found 1 error and fixed that. ;)
BUT I still have an access violation error. :(
In the component I have 2 TStringList objects with some data. When I create the dialogform for the editor I assign the data to the dialog-form's TStringLists. Then there is no problem editing that data. BUT the error arrise when I want to assign the edited data back to the components 2 TStringLists.
Yes Nestorua, I create the Editor form and as I said I can assign the data from the 2 StringLists and work with it BUT I can't "save" it back to the component. :(
The component's owner.name and name seems to be ok.
What type conversion. If you mean the (Component as ...) then yes I did.
There is a reason I don't want to publish my code but I think you could still help me if I give you the above information. ;)

HI,
I don't know how you do StringList saving, so propose to do it as following:
StringListOnTheForm.Assign(StringListOnEditor)
(not "=").
And I hope you have created StringListOnTheForm when created
your Component.
Sincerely,
Nestorua.

Did you create StringList in your Component?
Did you do assigning before destroying the Editor?
Did you try your Editor as an usual "second" form called from main form to edit the stringlists on that main form?
And TomasHelgi, it's not so easy to guess what the problem without your code, don't you think so?
Sincerely,
Nestorua.

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

HI, once more,
The code you wrote is not good.
It must be like that:
procedure TYourComponentEditor.ExecuteVerb(Index: integer);
var Dialog: TYourComponentEditorDlg;
begin
Dialog:=TYourComponentEditorDlg.Create(Application);
try
Dialog.Caption:=Component.Owner.Name+'.'+
Component.Name+' - '+
Dialog.Caption;

Well at runtime I can add or delete strings from the component using the components methods and let the component work with that data without any errors.
It is the design-time part that is not working. :(
I will try this tonight and se if that changes anything.

I tested it last night and found out that the error is not comming from the stringlists. It's commming from the Designer.Modified. When I commented that line the error disappeared.
But I still have some technical difficulties. ;)
The data I edit at design time does not appear to be accessible at runtime. :(
What am I forgeting or doing wrong ??
I have experienced this "error" also in the PropertyEditor where I'm calling the same dialog and editing the same stringlists ( http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=delphi&qid=20260174 )
Nestorua! You told me there that I had to implement the DefineProperties method. I did but that didn't work. :(
Should I use some other datacollection objects rather than the TStringList ???

HI,
If you use TStringList for Strings only, it's OK.
But if you use its Objects as well, then you must teach DELPHI
to load and save those data in its STREAM.
In this case you usually must override defineproperties method
and so on (DefineProperty...).
If Designer.Modified is commented then your changes done with
Editor are not supposed to be remembered in the Form designed.
Sincerely,
Nestorua.

>If you use TStringList for Strings only, it's OK.
I'm using TStringList for strings only and I thought that should be ok but it's not. :(
>If Designer.Modified is commented then your changes done with
>Editor are not supposed to be remembered in the Form designed.
I know that. :)
As I said before then the access violation error pops up when Designer.Modified is called. =>(

HI, Tomas,
Then I must (or am supposed) to give you the working example
of the component (as simple as possible) with additional
property of the type TStrings and the corresponding Component Editor.
I will do that today or tomorrow, OK?
Sincerely,
Nestorua.

Featured Post

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

This article explains how to create forms/units independent of other forms/units object names in a delphi project.
Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…

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…

Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message. In the To field, type your recipient's fax number @efaxsend.com.
You can even send a secure international fax — just include t…