Print Page | Close Window

Need help with a simple task panel task

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=2434
Printed Date: 08 November 2025 at 11:25am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Need help with a simple task panel task
Posted By: unit158
Subject: Need help with a simple task panel task
Date 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.



Replies:
Posted By: Maye Johnson
Date 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).




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