Stretching the envelope too far?
Stretching the envelope too far?
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
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
Pushing the envelope?
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
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
Pushing the envelope
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
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
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.
Igor Siticov.
Stretching the envelope
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
Nick
Stretching the envelope?
Hi Igor,
Have managed to reproduce this problem in a project using a datamodule, which I have sent to your email address.
Regards, Nick
Have managed to reproduce this problem in a project using a datamodule, which I have sent to your email address.
Regards, Nick
Stretching the Envelope
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
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
Stretching the envelope
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
AWasSorted := TElWideStringList(mStrings).Sorted;
Still don't know why though.
Nick
Stretching the Envelope
Hi Igor,
Sent the zip again to support email.
Sent the zip again to support email.
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:
2. Modify these line as following:
3. Re-build your project and TsiLang_ElPack package.
Please let me know if this helps.
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;
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;
Please let me know if this helps.
Best regards,
Igor Siticov.
Igor Siticov.
Stretching the envelope
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
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