Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Need help with a simple task panel task
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Need help with a simple task panel task

 Post Reply Post Reply
Author
Message
unit158 View Drop Down
Newbie
Newbie


Joined: 15 June 2005
Status: Offline
Points: 10
Post Options Post Options   Thanks (0) Thanks(0)   Quote unit158 Quote  Post ReplyReply Direct Link To This Post Topic: Need help with a simple task panel task
    Posted: 22 June 2005 at 7:46pm
I have been looking over the sample task panel project and such, and have become familiar with how it was created, etc.

However, I cannot figure out how to actually make the options in the task panel work. For example, if I wanted one of the options to just create a message box saying hello, how would I go about doing this?

Thanks in advance for any advice / suggestions.
Back to Top
Maye Johnson View Drop Down
Groupie
Groupie


Joined: 16 October 2004
Status: Offline
Points: 40
Post Options Post Options   Thanks (0) Thanks(0)   Quote Maye Johnson Quote  Post ReplyReply Direct Link To This Post Posted: 22 June 2005 at 8:15pm
I have a Task Panel derived from CView in my .h file as such:


class CSimToolboxTaskView : public CView
{
protected:
    //{{AFX_MSG(CSimToolboxTaskView)
    //}}AFX_MSG
    afx_msg LRESULT OnTaskPanelNotify(WPARAM wParam, LPARAM lParam);
    DECLARE_MESSAGE_MAP()
};


In the .cpp file, you direct the XTPWM_TASKPANEL_NOTIFY message to execute your Task Panel Notify function to take different actions depending on the ID of the clicked item.


BEGIN_MESSAGE_MAP(CSimToolboxTaskView, CView)
    //{{AFX_MSG_MAP(CSimToolboxTaskView)
    //}}AFX_MSG_MAP
    ON_MESSAGE(XTPWM_TASKPANEL_NOTIFY, OnTaskPanelNotify)
END_MESSAGE_MAP()

LRESULT CSimToolboxTaskView::OnTaskPanelNotify(WPARAM wParam, LPARAM lParam)
{
    switch (wParam)
    {
        case XTP_TPN_CLICK:
            {
                CXTPTaskPanelGroupItem* pItem = (CXTPTaskPanelGroupItem*)lParam;
                TRACE(_T("Click Event: pItem.Caption = %s, pItem.ID = %i\n"), pItem->GetCaption(), pItem->GetID());
                m_pParent->NotifyToolboxItem(pItem->GetID(), TRUE);
            }
            break;

        case XTP_TPN_RCLICK:
            {
                CXTPTaskPanelItem* pItem = (CXTPTaskPanelItem*)lParam;
                TRACE(_T("RClick Event: pItem.Caption = %s, pItem.ID = %i\n"), pItem->GetCaption(), pItem->GetID());
                m_pParent->NotifyToolboxItem(pItem->GetID(), FALSE);
            }
            break;
    }

    return 0;
}


I have mine get a pointer to the parent class in the OnCreate() function, and then call a function in the parent object telling it the item that was clicked.  The item is the ID that you added to the Task Panel's group via AddGroupItem().

If you want my source, please let me know and I will email it to you.  It's very easy to use once you know what classes to create and functions to call.  The samples from Codejock are very good (it's what I used).

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.031 seconds.