Win10, Seattle, Component Pack 8.1.4.
I have played around a little with the AdvGridColumnPicker and have an issue:
First I call grid.SetColumnOrder to Init the states in FormCreate ...
Then I show the ColumnPicker and rearange a couple of columns, remove 2 Columns and safe the columnstate in an ini file. After Restart of the program, grid.SetColumnOrder again inits the states in FormCreate and after that StringToColumnStates(ValueFromIniFile); restores the States to what was saved in the ini file. The States are reflected correctly by the grid. Everything looks good until now.
But If I now show the ColumnPicker, it doesn't contain the columns in it's listbox which I had removed from the grid. It doesn't contain any columns to be precise.
Any Idea what the reason could be? What am I doing wrong?
After calling StringToColumnStates(), you'd need to initialize the TAdvGridColumnPicker to contain the hidden columns which you can do by looping through all columns (0 to grid.TotalColCount - 1) and add the columns that were hidden (if grid.IsHiddenColumn())
That didn't work.
grid.IsHiddenColumn(ACol) always returns false in my case, even for the Columns that I have moved to the ColumnPicker. That sounded strange to me, so I looked a little deeper: When I move a Column from the grid to the ColumnPicker, the Column doesn't hide but sets its width to 0.
So grid.IsSuppressedColumn(ACol) returns true for that column.
Knowing that, I could Add it with AdvGridColumnPicker.AddToFieldChooser(ACol) I can add it to the ColumnPicker. But when I then move the Column back to the grid, it is removed from the ColumnPicker but doesn't show up in the grid. It is still suppressed.
Getting lost here...
I indeed made a mistake suggesting to use IsHiddenColumn, it should be IsSuppressedColumn. Other than this, I noticed a small regression with this initialization that causes the column width to always default to zero in this case. I fixed this meanwhile. Contact us by email for an incremental source update.
And, to make this easier, we have added a method AdvGridColumnPicker.Init to just do this initialization all automatically. This method will be included in the next update.