Stretching the envelope too far?

All announcements, questions and issues related to the TsiLang Components Suite.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Stretching the envelope too far?

Post by nickg »

Maybe I'm pushing things a little too far? I have an add-in for Word, using
Add-in-Express components. On the AddinModule form (which like a datamodule has no font), I want to use a TELPromptDialog component to deliver messages to the end user. I also want it to be translated using siLang translation components ELPack components which work very well with ELPack on other components in this project..

However at the moment, when I try to load the add-in it brings up an error unless the ElPack PromptDialog component is excluded from the language translation process. The component itself, and the add-in, and the translation components all work fine when no language translations involve the PromptDialog. This add-in includes forms with many other ElPack components on them such as an XTree, ElLabels, elEdits, elPopupButtons etc. All are translated perfectly well, only the ELPromptDialog is causing this error.

I'm using elPack 5.1.0.1 with Delphi 7 pro.

I'm wondering if the dialog component is trying to access something to do
with fonts that don't exist on the parent form.
Any help would be appreciated. Could someone walk me through what happens when a sib file is loaded?

TIA Nick
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

What kind of exception (error) message appears?

When SIB file is loaded TsiLang components change (update) the UI language of controls.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Pushing the envelope?

Post by nickg »

Hi Igor,
The error reported by the host program is:
TMydllError. The addin has fired an exception. Access violation at address 00D22789 in module mydll read of address: 00000000.

Putting showmessages in the code shows the problem is occuring after the sib filename has been assigned to the silangDispatcher.Filename component, and while the LoadAllFromFile procedure is being run. Adding the promptdialog to the exclusion list stops the error from occuring.

I've narrowed the error down to the ChangeLanguage procedure being called from siCustomLang.LoadAllFromBinaryFile. But that is a large procedure so it might take a while to see where the error is occurring.

Regards, Nick
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Pushing the envelope

Post by nickg »

Curious!

I have the following code in the siCutomLang.LaodAllFromBinaryFile procedure at line 6709 in sicomp.pas

showmessage('before ChangeLanguage');
ChangeLanguage;
showmessage('after ChangeLanguage');

The first showmessage works but the exception appears, and the second is not displayed.

Inside the siCustomLang.ChangeLanguage procedure being called I have right at the end of the procedure at line 5349

if Assigned(FOnChangeLanguage) then OnChangeLanguage(Self);
showmessage('end of change language procedure');
end;

This message displays OK. This seems to suggest that the return to the LoadAllFromBinaryFile procedure from the ChangeLanguage procedure is not happening properly. Could the fact that it is inside a dll be responsible, and if so why does it only happen when a ELPromptDialog is being used.

Nick
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

It is really strange. But this could be an issue in ElPromptDialog. There could be some incorrect memory management and when used in DLL it corrupts some addresses and return from function goes incorrect. But this is just my suppose. May be you can debug your DLL under Delphi with Word as host application? This will show you the place of problematic code.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Stretching the envelope

Post by nickg »

Tried that, it doesn't seem possible to stop on a break point and step through, but the event log shows that the last statement before the exception is a call to load oledlg.dll.
Nick
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Did you set Host Application and "Include remote debug symbols" options?
Anyway, the error in loading oledlg.dll looks realy strange.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Stretching the envelope?

Post by nickg »

Hi Igor,

Have managed to reproduce this problem in a project using a datamodule, which I have sent to your email address.

Regards, Nick
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Stretching the Envelope

Post by nickg »

Hi Igor,

I Have just spent several hours stepping through the code in the demo project I sent you, and discovered the error is occurring at line 158 in the procedure ChangeLanguageforElPackMultilines(const AsiLang: TsiCustomLang); in unit si_Elpack.pas.

The code line reads:
TElWideStringList(mStrings).Sorted := False;
I put a break on the line before, and ran it several times with no problems until I stepped onto line 158.

Why that happens I don't know, I'm hoping you can tell me, but it is happening when the the language file is loaded and also when a language is changed.

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

Post by isiticov »

Thanks Nick. Unfortunately, I have no any emails from you. Could you please re-send? May be there were some email problems. :(
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Stretching the envelope

Post by nickg »

I've been doing this too long, step executes the line you're on doesn't it, so the error is on line 157:
AWasSorted := TElWideStringList(mStrings).Sorted;

Still don't know why though.

Nick
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Stretching the Envelope

Post by nickg »

Hi Igor,

Sent the zip again to support email.
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Thank you. Just got it. Debugging...
Best regards,
Igor Siticov.
isiticov
Site Admin
Posts: 2416
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hi Nick,

Thank you again for the file. It looks like there is a problem in LMD ElPack. Anyway we've found the fix for it. Please do the following:
1. Open si_ElPack file.
2. Locate lines with code:

Code: Select all

        if mStrings is TElWideStrings then
        begin
          AWasSorted := TElWideStringList(mStrings).Sorted;
          TElWideStringList(mStrings).Sorted := False;
        end;
2. Modify these line as following:

Code: Select all

        if mStrings is TElWideStrings then
        begin
          if not (mStrings is TElWideStringArray) then
          begin
            AWasSorted := TElWideStringList(mStrings).Sorted;
            TElWideStringList(mStrings).Sorted := False;
          end;
        end;
3. Re-build your project and TsiLang_ElPack package.
Please let me know if this helps.
Best regards,
Igor Siticov.
nickg
Posts: 39
Joined: Tue Apr 05, 2005 9:17 am

Stretching the envelope

Post by nickg »

Hi Igor,

It stops the access error, but there is still a problem with the multi-line property ControlTexts used to store dialog button captions. It seems to be accessing the wrong item in the array, with the text for OK being displayed on the Yes button, when Yes and No are selected, and the No button is left blank. When the OK button is the only one set to show, it comes up blank too.
It looks like the index is 2 too high and part of the array is being left with empty strings.

I noticed when stepping through the code, that when the code removes the & signs it seems to remove some of the text as well, for instance N&o to All, removes the N as well as the &, leaving the text as o to all.

Also the dialog on the data module isn't causing an error, but it isn't being translated at all.

Regards, Nick
Post Reply