![]() |
LButton click event in PropertyGrid |
Post Reply ![]() |
Author | |
floydzhang ![]() Groupie ![]() Joined: 08 March 2008 Status: Offline Points: 50 |
![]() ![]() ![]() ![]() ![]() 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 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
Create Custom Item derived from CXTPPropertyGridItem and override its OnLButtonDown method. |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
floydzhang ![]() Groupie ![]() Joined: 08 March 2008 Status: Offline Points: 50 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
jimmy ![]() Senior Member ![]() Joined: 11 November 2003 Location: Austria Status: Offline Points: 516 |
![]() ![]() ![]() ![]() ![]() |
Hi,
CCustomItemEnum* pItemLib = (CCustomItemEnum*)(pPartLibraryItem->AddChildItem(new CCustomItemEnum(StringName, m_pSelectPart->m_strLibName)));//_T("Library") Jimmy |
|
![]() |
|
floydzhang ![]() Groupie ![]() Joined: 08 March 2008 Status: Offline Points: 50 |
![]() ![]() ![]() ![]() ![]() |
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 |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
yes.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
floydzhang ![]() Groupie ![]() Joined: 08 March 2008 Status: Offline Points: 50 |
![]() ![]() ![]() ![]() ![]() |
Hi, Oleg,
I tried but failed. Could you please give me some simple sample code? Regards Boyang |
|
![]() |
|
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
Hi,
See Samples\PropertyGrid\GridSample\CustomItems.cpp file - it shows how create derived classes and custom items.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |