Print Page | Close Window

Hiding prior PropertyGrid item can cause crash

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Property Grid
Forum Description: Topics Related to Codejock Property Grid
URL: http://forum.codejock.com/forum_posts.asp?TID=21870
Printed Date: 27 April 2024 at 10:27pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Hiding prior PropertyGrid item can cause crash
Posted By: wsl
Subject: Hiding prior PropertyGrid item can cause crash
Date 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 ?





Replies:
Posted By: dleibold
Date 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




Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net