Jump to content


Jordan

Member Since 13 Jul 2009
Offline Last Active Mar 08 2010 09:40 PM
-----

Topics I've Started

OnCellColoring problem

18 July 2009 - 12:31 AM

I have started using the OnCellColoring event, and for one of my applications, the event is triggered with a Row value that is equal to RowCount, causing an index out of bounds exception when I use that value. I had to place a test for this condition in the event code:

CODE
  if ARow >= TheGrid.RowCount then
    exit;
... actual code to set colors


The safety check seems to work fine, but I have to remember to include it in all my event handlers.

Has this problem been reported before?

Problem with LoadFromRegistry

14 July 2009 - 08:14 PM

Under some circumstances the LoadFromRegistry does not properly order the columns after a SaveToRegistry. The problem appears to be related to the order in which the column information is processed by NxColumns.ChangePosition.

To demonstrate this problem, create an NxGrid with four columns, with headers "First", "Second", "Third", and "Fourth". Fill in some rows with arbitrary data. Use the mouse to drag column "Fourth" to the first position. Then use the mouse to drag column "Third" to the second position so that the column headers now read "Fourth", "Third", "First", "Second". Perform a SaveToRegistry. Close the program, and restart it. Create the original NxGrid again, and perform a LoadFromRegistry. The columns will now show as "Fourth", "First", "Third", "Second".

I have attached code that demonstrates this problem. It is easy to reproduce.

I believe that the fix to this problem involves processing the saved registry information in a different order - rather than reading the original columns and setting each one to its new position, read the column order information from the registry, and then set the new column positions in increasing order of the New positions rather than the Old positions.


LoadFromRegistry suggestion

14 July 2009 - 05:34 PM

If the LoadFromRegistry does not find the registry keys, it uses default values, and those values might override values established at design time (especially column visibility). It would be useful to have a "RegistryEntriesFound" function that could test the registry to determine whether a SaveToRegistry had already been performed, so that LoadFromRegistry could be skipped or aborted if previously saved information is not present.

For my application, I frequently have columns that are invisible, and if I perform a LoadFromRegistry prior to SaveToRegistry, I lose the invisibility status of those columns.

Using the "SectionExists" method of the tCustomIniFile might be an appropriate way to perform this test.

Typo in NxCustomGridControl?

14 July 2009 - 05:21 PM

In unit NxCustomGridControl, line 2832, there appears to be a typo:

if IniFile.ReadString('Columns Sort Kind' + ID, 'Column' + IntToStr(i), 'Ascendig') = 'Ascending'

Should not the 'Acendig' be spelled 'Ascending'?

SaveToRegistry question

13 July 2009 - 08:29 PM

How can I specify the registry root (HKEY_LOCAL_MACHINE, for example) that will be used in the SaveToRegistry method? It seems that this method uses HKEY_CURRENT_USER by default.