Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Property Grid
  New Posts New Posts RSS Feed - Hiding prior PropertyGrid item can cause crash
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Hiding prior PropertyGrid item can cause crash

 Post Reply Post Reply
Author
Message
wsl View Drop Down
Newbie
Newbie


Joined: 17 May 2011
Location: New Zealand
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote wsl Quote  Post ReplyReply Direct Link To This Post Topic: Hiding prior PropertyGrid item can cause crash
    Posted: 02 September 2013 at 2:32am
I modified the Drawcli_vc110 sample (16.2.0) to add a new PropertyGrid Item to hide the Author Item.
I presume that it is acceptable to do this (i.e. hide a prior item in the property grid) from inside OnGridNotify.



The code to hide it is:
LRESULT CMainFrame::OnGridNotify(WPARAM wParam, LPARAM lParam)
{
    if (wParam == XTP_PGN_ITEMVALUE_CHANGED )
    {
        CXTPPropertyGridItem* pItem = (CXTPPropertyGridItem*)lParam;
        if (pItem->GetID() == 999 )
        {
            if (pItem->GetValue() == "False" )
                m_pAuthorItem->SetHidden(FALSE);
            if (pItem->GetValue() == "True" )
                m_pAuthorItem->SetHidden(TRUE);
        }
    }

This all works fine unless the mouse scroll wheel is used to change the value from False to True and then a left mouse click is done in the white space below the property grid item. This causes a crash.

Is this a bug in PropertyGrid or is what we are doing unacceptable ?


Back to Top
dleibold View Drop Down
Groupie
Groupie
Avatar

Joined: 08 March 2010
Location: Canada
Status: Offline
Points: 13
Post Options Post Options   Thanks (0) Thanks(0)   Quote dleibold Quote  Post ReplyReply Direct Link To This Post Posted: 24 September 2013 at 10:53am
1. Does the crash still occur if the OnGridNotify() code handling is removed?

2. If no for 1., have you determined the specific crash message and location running in debug mode?

3. Is m_pAuthorItem properly assigned to point to the item object? e.g. it should not be NULL nor pointing to an old deleted item

4. lParam should be good, but might want to check its value to ensure it is not NULL, and that the cast pItem represents a valid item

5. Is it just that specific sequence of steps or does it always crash after changing the picklist e.g. try clicking within the grid instead of into the white space below

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.