Print Page | Close Window

LButton click event in PropertyGrid

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=13155
Printed Date: 23 June 2025 at 8:22am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: LButton click event in PropertyGrid
Posted By: floydzhang
Subject: LButton click event in PropertyGrid
Date Posted: 13 January 2009 at 1:18am
Hi,

Propertygrid can handle events XTP_PGN_SORTORDER_CHANGED, XTP_PGN_SELECTION_CHANGED,  XTP_PGN_ITEMVALUE_CHANGED , XTP_PGN_REQUESTEDIT......

But I can't see how to handle mouse LButtonClk, not LButtonDBClk. I want to implement a function that when user mouse lbutton single clicks propertygrid item, the app will pop up a dialog, when user click the grid item again, the dialog will be closed. How to do that? I tried XTP_PGN_SELECTION_CHANGED, but it's not I want.

Thanks!

Regards
Boyang



Replies:
Posted By: Oleg
Date Posted: 13 January 2009 at 6:20am
Hi,

Create Custom Item derived from CXTPPropertyGridItem and override its OnLButtonDown method.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: floydzhang
Date Posted: 13 January 2009 at 10:26pm
Hi, Oleg:

I create a sample class as following:

class CCustomItemEnum: public CXTPPropertyGridItemEnum
{
protected:
    virtual BOOL OnLButtonDown(UINT nFlags, CPoint point)
    {
        AfxMessageBox(_T("Test here."));
    }
};

And insert this class as following:

CCustomItemEnum* pItemLib = (CCustomItemEnum*)(pPartLibraryItem->AddChildItem(new CXTPPropertyGridItem(StringName, m_pSelectPart->m_strLibName)));//_T("Library")

Also add some CXTPPropertyGridItemConstraint as following:

int i=1;
POSITION posLib = pDoc->m_board.m_liblist.GetHeadPosition();
while (posLib != NULL)
{
       i++;
      CLib* lib = (CLib*) pDoc->m_board.m_liblist.GetNext(posLib);
       if(lib->m_uLibType != pPart->m_uPartType) //heli0055
              continue; //heli0055
              if(lib->m_SubLibIndex>0)
                    continue;
              CXTPPropertyGridItemConstraint* temp = pItemLib->GetConstraints()->AddConstraint(lib->m_strName);
}

        pItemLib->SetFlags(xtpGridItemHasComboButton|xtpGridItemHasEdit);
            pItemLib->SetEditStyle(ES_UPPERCASE);
            CXTPPropertyGridItemConstraints* pList = pItemLib->GetConstraints();
            pList->Sort();


Then, I click the gird item, the test dialog doesn't appear. What wrong?

Regards
Boyang


Posted By: jimmy
Date Posted: 14 January 2009 at 4:25am
Hi,

CCustomItemEnum* pItemLib = (CCustomItemEnum*)(pPartLibraryItem->AddChildItem(new CCustomItemEnum(StringName, m_pSelectPart->m_strLibName)));//_T("Library")

  Jimmy



Posted By: floydzhang
Date Posted: 14 January 2009 at 10:17pm
Hi,  Jimmy,

Thank you for your reply.

But when I modified the code as your suggestion, the compiler gave an error:   C2660: “CCustomItemEnum::CCustomItemEnum”:  Function can't accept two paramters.

I need give a constructor for that class?

Regards
Boyang



Posted By: Oleg
Date Posted: 15 January 2009 at 1:45am
yes.

-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: floydzhang
Date Posted: 15 January 2009 at 2:54am
Hi, Oleg,

 I tried but failed. Could you please give me some simple sample code?

Regards
Boyang


Posted By: Oleg
Date Posted: 15 January 2009 at 4:25am
Hi,
 
See Samples\PropertyGrid\GridSample\CustomItems.cpp  file - it shows how create derived classes and custom items.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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