I have a property grid that contains properties ( name value pairs ). In the simplest case, a single property is displayed as a label ( for the name ) and a textbox ( for the value, which can be edited by the user ) displayed on a panel. The panels for all the properties are displayed in a panel with scrollbars.
This code:
form fm( 0, nana::size{ 400, 600 } );
fm.caption("PropGrid2 demo 2");
// Construct property grid
panel<true> pnl( fm, { 20, 20, 300, 600 });
cPropGrid pg( pnl );
pg.category( "Strings" );
// Add 20 properties
for( int k = 0; k < 20; k++ )
{
// add property ( label and textbox )
pg.string(
"test" + std::to_string(k), // label caption
std::to_string(k) ); // textbox initial value
}
Shows
That’s fine!
What happens if the form is not high enough to show all the properties?
form fm( 0, nana::size{ 400, 300 } );
gives
Not perfect, but acceptable for the moment.
The bigger problem is when the form is resized to reveal the properties that were outside the initial form size
Although the textboxes are revealed as expected in the larger resized form, the labels are not!
Note that this is not a simple problem with labels. If I add a label to the form located outside the initial form size, it is revealed correctly when the form is resized.
// Add label to form, outside the initial form size
nana::label lbtest( fm );
lbtest.move( {10, 650, 60,30});
lbtest.caption("test");
gives after form resizing
So it must be something to do with adding labels on a panel on another on another panel on the form.
What is the difference between the textbox and the label that might account for the label not appearing while the textbox does?
I do not expect anyone to look at the code for this and fix it for me! I would just like a hint from someone who knows the detailed implementation of labels and textboxes about what difference between them might explain this behaviour and point me in the right direction to working around this problem.
( However, it anyone does want to look at the complete code, it can be seen here: https://github.com/JamesBremner/nana-extra/tree/master/propgrid2 )