Print Page | Close Window

CCustomItemIPAddress

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=23237
Printed Date: 07 May 2024 at 1:41pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CCustomItemIPAddress
Posted By: netman2
Subject: CCustomItemIPAddress
Date Posted: 09 January 2017 at 6:41am
class CCustomItemIPAddress : public CXTPPropertyGridItem
{
class CInplaceEditIPAddress : public CXTPPropertyGridInplaceEdit
{
public:
BOOL Create(LPCTSTR /*lpszClassName*/, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
if (!CWnd::Create(WC_IPADDRESS, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext))
return FALSE;

ModifyStyle(WS_BORDER, 0);
ModifyStyleEx(WS_EX_CLIENTEDGE, 0, SWP_FRAMECHANGED);
return TRUE;
}
};

public:
CCustomItemIPAddress::CCustomItemIPAddress(CString strCaption)
: CXTPPropertyGridItem(strCaption)
{
}

protected:
virtual CXTPPropertyGridInplaceEdit& GetInplaceEdit()
{
return m_wndEdit;
}

private:
CInplaceEditIPAddress m_wndEdit;

};

Now I'm using above CCustomItemIPAddress from sample code. 

It was nice until I remove one of the CCustomItemIPAddress from PropertyGrid.

When I remove CCustomItemIPAddress from PropertyGrid, my propertygrid's font and size are changed.

I don't know how to handle this. 

This below is my sample code.

::OnGridNotify(WPARAM wParam, LPARAM lParam)
{
CXTPPropertyGridInplaceButton * button = (CXTPPropertyGridInplaceButton *)lParam;
button->GetItem()->Remove();
}

You can test in Codejock sample code in PropertyGrid. There is CCustomItemIPAddress.

Please help me!




Replies:
Posted By: olebed
Date Posted: 12 January 2017 at 9:47am
CCustomItemIPAddress control  doesn't have inplace buttons.

Your code need to be improved 
LRESULT CPropertyGridDlg::OnGridNotify(WPARAM wParam, LPARAM lParam)
{
    if (wParam == XTP_PGN_DBLCLICK || wParam == XTP_PGN_RCLICK || wParam == XTP_PGN_INPLACEBUTTONDOWN)
    {
        //CXTPPropertyGridInplaceButton* button1 = DYNAMIC_DOWNCAST(CXTPPropertyGridInplaceButton, (CWnd*)lParam);    //wrong cast
        CXTPPropertyGridInplaceButton* button = dynamic_cast<CXTPPropertyGridInplaceButton*>((CWnd*)lParam);
        if (button)
        {
            CXTPPropertyGridItem*  pGridItem = button->GetItem();
            if(pGridItem)
                pGridItem->Remove();
        }

    }......



Posted By: netman2
Date Posted: 17 January 2017 at 11:36pm
I added button into IP Address Control.

So it has a button inside IP Address Control.

And I tried your solution, It's a same.

Thanks, your reply!



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