Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - LButton click event in PropertyGrid
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

LButton click event in PropertyGrid

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


Joined: 08 March 2008
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote floydzhang Quote  Post ReplyReply Direct Link To This Post Topic: LButton click event in PropertyGrid
    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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
floydzhang View Drop Down
Groupie
Groupie


Joined: 08 March 2008
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote floydzhang Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
jimmy View Drop Down
Senior Member
Senior Member


Joined: 11 November 2003
Location: Austria
Status: Offline
Points: 516
Post Options Post Options   Thanks (0) Thanks(0)   Quote jimmy Quote  Post ReplyReply Direct Link To This Post Posted: 14 January 2009 at 4:25am
Hi,

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

  Jimmy

Back to Top
floydzhang View Drop Down
Groupie
Groupie


Joined: 08 March 2008
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote floydzhang Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2009 at 1:45am
yes.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
floydzhang View Drop Down
Groupie
Groupie


Joined: 08 March 2008
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote floydzhang Quote  Post ReplyReply Direct Link To This Post Posted: 15 January 2009 at 2:54am
Hi, Oleg,

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

Regards
Boyang
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
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.047 seconds.