Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CCustomItemIPAddress
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CCustomItemIPAddress

 Post Reply Post Reply
Author
Message
netman2 View Drop Down
Groupie
Groupie


Joined: 19 April 2016
Location: Seoul
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote netman2 Quote  Post ReplyReply Direct Link To This Post Topic: CCustomItemIPAddress
    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!

Back to Top
olebed View Drop Down
Admin Group
Admin Group


Joined: 01 July 2014
Location: Ukraine
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote olebed Quote  Post ReplyReply Direct Link To This Post 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();
        }

    }......

Back to Top
netman2 View Drop Down
Groupie
Groupie


Joined: 19 April 2016
Location: Seoul
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote netman2 Quote  Post ReplyReply Direct Link To This Post 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!
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.156 seconds.