Menu

#153 GetPropertyRect fails, when the last item is collapsed

open
nobody
None
5
2011-08-10
2011-08-10
No

I have this code in my application:
wxPGProperty *first = grid->GetFirstProperty();
wxPGProperty *last = grid->GetLastProperty();
wxRect rect = grid->GetPropertyRect(first, last);

And when the last item is collapsed, the returned rect.height is equal to -1.
The reason is that the wxPGProperty::GetY2 returns -1 if the item is collapsed.

I've applied the following patch which seems to fix the problem:

Index: src/propgrid.cpp

--- src/propgrid.cpp (revision 7316)
+++ src/propgrid.cpp (working copy)
@@ -2068,7 +2068,9 @@
for ( parent = GetParent(); parent != NULL; parent = child->GetParent() )
{
if ( !parent->IsExpanded() )
- return -1;
+ // CB change start
+ return parent->GetY2(lh);
+ // CB change end
y += parent->GetChildrenHeight(lh, child->GetIndexInParent());
y += lh;
child = parent;

The patch is against the Code::Blocks' svn.

Discussion


Log in to post a comment.