DevExpress DBTreeList ExtLookupCombo Column

All announcements, questions and issues related to the TsiLang Components Suite.
Post Reply
plumothy
Posts: 18
Joined: Mon Oct 25, 2010 8:24 pm

DevExpress DBTreeList ExtLookupCombo Column

Post by plumothy »

TsiLang has caused me a massive amount of wasted time this week.

I have a form called frmAssetTree with a DevExpress TcxDBTreeList, called tlAssets. This TreeList has a column (called tlAssetsAnalysisID) which had its Properties property set to LookupComboBox. There were 3 columns names in tlAssetsAnalysisID.Properties.ListFieldNames.

So, TsiLang had these 3 entries in the Collections section of the Editor:
TfrmAssetTree.tlAssetsAnalysisID.Properties.ListColumns[0].Caption
TfrmAssetTree.tlAssetsAnalysisID.Properties.ListColumns[1].Caption
TfrmAssetTree.tlAssetsAnalysisID.Properties.ListColumns[2].Caption


That was all fine - exactly what I would expect.

Then I decided to change the tlAssetsAnalysisID column Properties from LookupComboBox to ExtLookupComboBox.

Now the Translation Editor shows nothing in the Collections tab. That is good because the ExtLookupComboBox does not have any collections of objects that have captions.

As usual, I saved my project to a SIL file and then exported it to a SIB file.

Before building my application I always clear all translations and then load the SIB file at runtime.

At runtime I get an error when I open the AssetTree form: "List index out of bounds (-1)".

I debugged siComp and discovered that it is still looking for tlAssetsAnalysisID.Properties.ListColumns[0].Caption.

So, opened the SIL file and in the Collections section I can see 2 of the original 3 lookup column captions:
TfrmAssetTree.tlAssetsAnalysisID.Properties.ListColumns[0].Caption
TfrmAssetTree.tlAssetsAnalysisID.Properties.ListColumns[1].Caption


They are also in the SIB file.

I presume this is why I get the error at runtime.

Have I done anything wrong or is it a problem with siLang?

How do put this right?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Hello,

May be you created SIL file before opening Translation Editor or updating translations in TsiLang? Because it looks like still contained old Collections information. It is not possible to automatically catch the event of collection property change in other components so just be sure to either call Update Translations from TsiLang popup-menu or open Translation Editor to update translations list.
Also you can save to SIB file directly without using SIL as intermediate.
Best regards,
Igor Siticov.
plumothy
Posts: 18
Joined: Mon Oct 25, 2010 8:24 pm

Post by plumothy »

Thanks for the reply. I have spent 2 days battling with this so I have been through the following procedure many many times:
- Update Translations
- Open Translations Editor for this form and checked that the Collections section is empty
- Close & Save Translation Editor
- Save Project to SIL, then Export to SIB.

The SIL and SIB both still have the two of the original three ListColumns entries.

As a workaround for this problem I have manually deleted the two ListColumn entries from the SIB. But, I would like to be able to trust the the SIB to contain the correct entries (because there are thousands of them in the entire project). At the moment I can't trust it.

Am I doing it wrong?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

Will the same occur if you save your translations into the NEW SIL file?
Best regards,
Igor Siticov.
plumothy
Posts: 18
Joined: Mon Oct 25, 2010 8:24 pm

Post by plumothy »

Yes. As I said before, I have done it many times.
plumothy
Posts: 18
Joined: Mon Oct 25, 2010 8:24 pm

Post by plumothy »

I think I have figured out what is going on.

My project is quite big - 55 forms, resulting in several thousand items for translation.

Before I build my project for release, I save the project to a SIL file, then select all the forms and clear all the translations. I then export the SIL to SIB and load the SIB at runtime (because I understand this to be best for performance - is that correct?).

Then I work on my project again to enhance it. When ready, I load the SIL file again. But, because the project has changed, there are now items in the SIL file which are no longer in the project (just as there will be new items in the project which are not in the SIL file).

So, if I removed an item from the project it no longer appears in the translation editor, but siLang still has an entry for it somewhere (which came from the SIL). Then, when I save the project to SIL that entry is still being written to the SIL, even though it wasn't in the translation editor.

Try these steps:
01. Create a new delphi VCL Forms application
02. Onto Form1, add a TsiLangRT.
03. Add a TcxLookupComboBox
04. Open the editor for cxLookupComboBox1.Properties.ListColumns
05. Add 3 columns and give them different captions ('Col 0', 'Col 1' and 'Col 2')
06. Open the Translations Editor and you see the 3 column captions in the Collections section.
07. Close the translations editor
08. In TsiLang Expert, save the project to a '3 Cols.SIL'.
09. Double-click on '3 Cols.SIL' and you see the 3 column captions in the Collections section.
10. Close the SIL.
11. In TsiLang Expert, clear the translations
12. Save the Delphi project
13. Open the editor for cxLookupComboBox1.Properties.ListColumns
14. Remove Col 1
15. Right-click on siLangRT1 and select Clear Translations
16. Open the Translations Editor and see the column captions in the Collections section - now only 2 of them.
17. Close the translations editor
18. In TsiLang Expert, load '3 Cols.SIL'
19. In TsiLang Expert, Save the project to '2 Cols.SIL'
20. Double-click on '2 Cols.SIL' and you will see 2 column captions in the Collections section.
They have the captions 'Col 0' and 'Col 1' ('Col 2' is not there). But why? We deleted the column with caption 'Col 1' and we did not delete the column with caption 'Col 2'.

I think this is related to the issue I described in the original post.
Please let me know if I did something wrong in the steps above.
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

18. In TsiLang Expert, load '3 Cols.SIL'
19. In TsiLang Expert, Save the project to '2 Cols.SIL'
As you loaded SIL with 3 items in collections but there were only 2 items in actual project the third item was deleted. TsiLang UNABLE to uniquely identify collection items so they are just numbered sequentially.
Before deletion there were:
Item[0] = Col 0
Item[1] = Col 1
Item[2] = Col 2


After deletion:
Item[0] = Col 0
Item[1] = Col 2


But in SIL file you have:
Item[0] = Col 0
Item[1] = Col 1

Item[2] = Col 2

So when you loaded info from SIL the items became:
Item[0] = Col 0
Item[1] = Col 1
plumothy
Posts: 18
Joined: Mon Oct 25, 2010 8:24 pm

Post by plumothy »

OK, I now understand what was happening in my test project - thank you.

Was this also responsible for the runtime error (List index out of bounds) that I reported in my original post?
isiticov
Site Admin
Posts: 2383
Joined: Thu Nov 21, 2002 3:17 pm

Post by isiticov »

List index error in initial post might be caused by the fact that list columns captions exist in loaded SIL/SIB file but were deleted in actual component.
Best regards,
Igor Siticov.
Post Reply