Home » U++ Library support » ArrayCtrl, HeaderCtrl & GridCtrl » How to hide/show gridctrl column at runtime
|
|
Re: How to hide/show gridctrl column at runtime [message #44497 is a reply to message #44483] |
Wed, 18 March 2015 08:36 |
|
GetColumn() methods should be rather used before application window appears - for grid initialization. They don't refresh the grid. But you can call to force it. You can also call ShowColumn(int n, true) or HideColumn(int n, true) instead. I'm aware this is not so intuitive but it should solve your problem.
|
|
|
|
Re: How to hide/show gridctrl column at runtime [message #48745 is a reply to message #44456] |
Sat, 09 September 2017 21:33 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
I am resuming this old thread because my problem is exactly the same (U++ 11300, MS2017).
My GridCtrl has 16 columns and the one in position 15 is hided.
Then an OptionButton hide/show it when pressed. Here is the code:
void VegaTab1::ShowInfoCol()
{
if (optGrid.Get()) {
grid.GetColumn(15).Hidden(false);
grid.Repaint(true, false);
}
else {
grid.GetColumn(15).Hidden(true);
grid.Repaint(true, false);
}
}
If I show/hide that column several times, I observe that the grid looks each time differently. In particular column 15 (the one I hide/show) decrease its width constantly up to become very little after many show/hide.
It seems the grid is not recalculating properly its dimensions.
Is this a bug? Is there a better way to achieve the same result?
Thanks,
Luigi
[Updated on: Sat, 09 September 2017 21:34] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Apr 24 13:26:28 CEST 2024
Total time taken to generate the page: 0.01781 seconds
|