Hi,
I have updated the TMS VCL UI Pack from version 13.5.0 to 13.5.5. In the new version, the behavior of the HideColumn()
procedure has changed. The version history notes:
9.1.5.2 : Fixed : Issue with HideColumn() and range selection change.
I tried using the Index
property instead of DefIdx
, but it does not work. Every time I call my init procedure, I get a grid index exception.
My question: What is now the correct way to show and hide columns at runtime?
Example code (the grid has 13 columns):
function TfrExampleFrame.Init: Boolean;
var
LDefIx: Integer;
begin
LDefIx := grdOrder.ColumnByName['AUFNAME'].DefIdx; // Index=1
grdOrder.UnHideColumn(LDefIx);
LDefIx := grdOrder.ColumnByName['AUFREF'].DefIdx; // Index=2
grdOrder.HideColumn(LDefIx);
LDefIx := grdOrder.ColumnByName['REZBZ'].DefIdx; // Index=5
grdOrder.HideColumn(LDefIx);
LDefIx := grdOrder.ColumnByName['REZTID'].DefIdx; // Index=6
grdOrder.UnHideColumn(LDefIx);
LDefIx := grdOrder.ColumnByName['REZRE'].DefIdx; // Index=7
grdOrder.UnHideColumn(LDefIx);
end;
The fix for using HideColumn is unrelated to column indexing. It is related to keeping the range of selected cells while hiding / unhiding columns.
This change should not affect the unhide & hide itself, just the selected range of cells after hiding or unhiding.
Do you use range selection? What exact unexpected behavior do you get with this new version? If you use range selection, test if the problem is resolved by ensuring that just one cell is selected in a column that won't be affected by hiding or unhiding.
In this grid, the goRangeSelect
option is enabled, as it is the default value in the grid. In my case, I don’t need range selection. Does this option need to be disabled when using HideColumn
to ensure that showing and hiding columns works correctly? I use this grid very frequently, and when I disable this option with the new version of AdvGrid, it works as expected.
If I do need range selection, what is the correct way to handle hiding and unhiding columns?
Thanks for your feedback!
I retested it from here but couldn't see an issue so far in connection with range selection and column hiding.
Could you isolate this and send a test project + steps with which we can reproduce this?
Here’s my example: I’ve now added range selection to the options. When I disable range selection, everything works fine.
TMSGrid.zip (9.1 KB)
Thanks for this sample.
I traced & solved this issue. Next update of TMS VCL UI Pack will address this.
I have seen that version v13.5.6.0 is available.
Is the problem with this version fixed?
Should be fixed indeed in the latest release.