Access violation when calling EditProperty EditAll of LangRT

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
emin
Posts: 8
Joined: Thu Apr 24, 2003 7:52 am

Access violation when calling EditProperty EditAll of LangRT

Post by emin »

Using 5.2.2 CLX D7
I am getting Access violation when I try to call
LangRT.EditProperty or EditAll

the exception raises in QsiTransEditor
TsiTransEditFrm.GetProperties

Tested the same code on Kylix 3, everything is fine.

Anyone aware of this problem?

Emin
gaivans
Posts: 71
Joined: Fri Nov 29, 2002 4:10 pm

Post by gaivans »

Hello,

Which third-party components do you use in your project?

For the quick solution of the problem I suggest the following:

1. Open the TsiLang_D7_CLX.dpk package and open its file
"QsiTransEditor.pas"
2. Locate in the unit the method:
procedure TsiTransEditFrm.GetProperties(const AComp: TsiCustomLang);
3. After the line:
...
RootNode := TreeView.Items.AddObject(nil, 'Translations', nil);
...
remove or comment the line:
...
if sfDesignTime in Flags then
...
4. Save the unit and re-build the package.

After that the Translation Editor should work in the run-time
Best regards,
Serghei Gaivan
emin
Posts: 8
Joined: Thu Apr 24, 2003 7:52 am

Post by emin »

>> Which third-party components do you use in your project?

Only FastReport and TsiLang.

Will this solution be included in coming releases or shall I apply
this source change in new release?

Thank you,
Emin
emin
Posts: 8
Joined: Thu Apr 24, 2003 7:52 am

Post by emin »

applied the fix and delete/rebuild the package, but it did not help.
Still getting the access violation in TsiTransEditFrm.GetProperties
at line:
FComp := TsiCustomLang(TComponentClass(GetClass AComp.ClassName)).Create(nil));

Thank you
Emin
gaivans
Posts: 71
Joined: Fri Nov 29, 2002 4:10 pm

Post by gaivans »

Hello,

I have downloaded FastReport 3 CLX beta and it seems compatible with TsiLangRT. At least when I add a TsiLangRT to their demo project it works properly either with the above changes or without.

Which version of FastReport do you use? Is that possible to reproduce the problem in a small test project? If so, could you please send it to us at
gaivans@sicomponents.com
Best regards,
Serghei Gaivan
emin
Posts: 8
Joined: Thu Apr 24, 2003 7:52 am

Post by emin »

I have a test project to reproduce this.
but you will be able to reproduce in the following case.

Just derive a new component from TsiLangRT
and use this derived component in your project.

Even the derived component does not add/change any behavior,
I start getting access violation.

Thanks in advance,
Emin

sending test project via email.
gaivans
Posts: 71
Joined: Fri Nov 29, 2002 4:10 pm

Post by gaivans »

Hello,

Do you create a component derived from TsiLangRT? Then, "GetClass" returns nothing and it causes an AV at the line:
FComp := TsiCustomLang(TComponentClass(GetClass(AComp.ClassName)).Create(nil));

Look at the initialization sections of the "siLangRT.pas" or "siComp.pas". Due to several reasons we register our classes. So, if you derive a class from TsiLangRT or from other TsiCustomLang you need to register it at the initialization section of corresponding unit. For example,
...

initialization

if GetClass('TMyDerivedsiLang') = nil then RegisterClass(TMyDerivedsiLang);
...
Best regards,
Serghei Gaivan
emin
Posts: 8
Joined: Thu Apr 24, 2003 7:52 am

Post by emin »

>>> initialization
>>> if GetClass('TMyDerivedsiLang') = nil then RegisterClass
>>> (TMyDerivedsiLang);

ok this was missing in my derived class.
After adding RegisterClass I can safely call editAll and other edit methods.

Usually I never RegisterClass unless I build projects in run time
package (BPL) mode.

Thank you very much for your fast support.

Emin Borbor,
Kimyatas
Post Reply