Problem with const section

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
Anske
Posts: 6
Joined: Wed Sep 17, 2003 10:52 am

Problem with const section

Post by Anske »

I'm currently evaluating TsiLang Components and have some problems with translating the const section. After translating the strings I'm trying to run my program, but is fails to start giving me a Stack Overflow message.

Any help would be apreciated.

Regards
Anske
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

It looks like in your code there is circular calling of some procedure. Please try to reproduce the problem on simple sample test project and check if error gone. And then just compare sources of your unit with sample test units to check the differences.
Anske
Posts: 6
Joined: Wed Sep 17, 2003 10:52 am

Post by Anske »

This works fine.
I'm using the components on a datamodule which is autocreated before the mainform (in both apps)
I put for testing a breakpoint on the 'Updatestrings' in both the 'oncreate' as well as in the 'changelanguage' procedures and found out that in my 'problem' app the oncreate is never called (property settings are OK) in the little demo app this works fine
Anske
Posts: 6
Joined: Wed Sep 17, 2003 10:52 am

Post by Anske »

Digging a little deeper.
Somehow the procedure ChangeLanguage is run twice before the oncreate of the datamodule. This is not happening in my little demo app.
any clou?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

This looks like somewhere in your "problem" application code you're manually calling OnCreate event of datamodule. Please check this and let us know if this is the origin of problem.
Anske
Posts: 6
Joined: Wed Sep 17, 2003 10:52 am

Post by Anske »

Nope.
I have at this moment 2 TsiLang components (1 on the datamodule and 1 on the main form) linked to the dispatcher. If I cut lose both links to the dispatcher all is going well.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

In such case the situation with calling twice ChangeLanguage is normal because it is calling for each TsiLang. Then I suppose the problem with Stack Overflow is somewhere in your code.
terryk
Posts: 8
Joined: Wed May 18, 2005 1:33 pm

Same Error in current TSILang 6.0.4

Post by terryk »

Hi!
In my (big) project I have the same problem with Stack-Overflow.
Now I found the error. It is a problem of TSILang-Expert that can be reproduced. My project has some inherited frames and when Expert modifies code of const section, it adds (by mistake?) the line "UpdateStrings" in the same procedure UpdateStrings which causes this infinte loop. Here's what the Expert does:

// Complete proc added by Expert
procedure TMyFrame.siLang1ChangeLanguage(Sender: TObject);
begin
UpdateStrings;
inherited;
end;

// Complete proc added by Expert
procedure TMyFrame.UpdateStrings;
begin
sAlarm_1000 := siLang.GetTextOrDefault('strsAlarm_1000');
sTooHigh := siLang.GetTextOrDefault('strsTooHigh');
sTooLow := siLang.GetTextOrDefault('strsTooLow');
sOK := siLang.GetTextOrDefault('strsOK');
UpdateStrings; // ERROR!!!!
inherited;
end;

Well I also found out, that Expert will not always produce this error. My project has about 50 Frames an the error occured only in about 35-40 Frames.
Any suggestion about this?

Regards
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

We will try to improve this, but currently the workaround would be only manually check the source generated by expert and fix if it is inappropriate. :(
Best regards,
Igor Siticov.
Post Reply