Print Page | Close Window

to insert image or icon to CXTPControl;

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=12307
Printed Date: 21 May 2024 at 11:53pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: to insert image or icon to CXTPControl;
Posted By: copycdx2
Subject: to insert image or icon to CXTPControl;
Date Posted: 01 October 2008 at 6:21am

I would like to insert icon to CXTPControl.

CXTPControl* pCtrl = m_pPopupBar->GetControls()->Add( xtpControlButton, ID_FILE_TEST01 );


and, I hope to catch message of button click.





Replies:
Posted By: Oleg
Date Posted: 01 October 2008 at 2:07pm
Hi,
You need add image to image manager for ID_FILE_TEST01 id:
 
pCommandBars->GetImageManager()->SetIcons(,,);
 


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


Posted By: copycdx2
Date Posted: 01 October 2008 at 8:00pm

 my class don't have CXTPFrameWnd.

 class Cg3OutlookBarContainer : public CTaskPanelBase.

 so, i created CXTPPopupBar by CreateObject();

 how get commandbar point ?

 m_pPopupBar = (CXTPPopupBar*)CXTPPopupToolBar::CreateObject();


-----------------------------------------------------------------------------------------------

Cg3OutlookBarContainer::~Cg3OutlookBarContainer()
{
    if( m_pPopupBar )
    {
        AFX_MANAGE_STATE(AfxGetStaticModuleState());

   //  when create code.
   //  insert below code and kill.  not insert below code and not kill.
   // pCtrl->GetImageManager()->SetIcons(IDR_TOOLBAR1);

        m_pPopupBar->InternalRelease();    <= error;

        m_pPopupBar = NULL;
    }
}


                if( m_pPopupBar == NULL )
                {
                    CXTPControl* pCtrl = NULL;

                    HICON hIcon = ::LoadIcon( AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ANALYSIS01) );
                    CXTPControlButton* pButton01 = new CXTPControlButton();

                    pButton01->SetCaption(_T("hello"));
                    pButton01->SetStyle(xtpButtonIcon);
                    pButton01->SetHeight( 48 );
                    pButton01->SetWidth( 48 );
                    //pButton01->SetCustomIcon(hIcon);

                    m_pPopupBar = (CXTPPopupBar*)CXTPPopupToolBar::CreateObject();
                    m_pPopupBar->SetOwner(this);
    //                m_pPopupBar->SetTearOffPopup(_T("Text Color"), IDR_TOOLBAR1, 0);
                    m_pPopupBar->GetControls()->Add( pButton01);
                    pCtrl = m_pPopupBar->GetControls()->Add( xtpControlButton, ID_FILE_TEST01 );
                    pCtrl->SetCaption(_T("555"));
                    pCtrl->SetHeight(48);
                    pCtrl->SetWidth(48);
                    pCtrl->GetImageManager()->SetIcons(IDR_TOOLBAR1);
                    pCtrl->SetIconId( ID_BUTTON40007 );

                }

                if( m_pPopupBar )
                {
                    CRect rc;
                    this->GetWindowRect(&rc);
                    this->ScreenToClient(&rc);
                    POINT pp;
                    GetCursorPos(&pp);
                    m_pPopupBar->Popup( pp.x-100, pp.y, NULL );
                }



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