Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Command bar messages and bitmap
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Command bar messages and bitmap

 Post Reply Post Reply
Author
Message Reverse Sort Order
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 Topic: Command bar messages and bitmap
    Posted: 27 March 2009 at 1:56am
Hi,
 
You have catch it it in CMainFrame.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
JerryEvans View Drop Down
Groupie
Groupie
Avatar

Joined: 01 May 2008
Location: United Kingdom
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote JerryEvans Quote  Post ReplyReply Direct Link To This Post Posted: 26 March 2009 at 10:47am
Oleg: In my CDocument derived class

    ON_XTP_INITCOMMANDSPOPUP(OnInitCommandsPopup)

Nothing is caught. I can see the notes in XTPCommandBarsDefines.h but this does not seem to work. Is there a message generated when a specific dropd-own menu is about to be displayed? OnInitCommandsPopup seems to be a little bit generic.
Back to Top
JerryEvans View Drop Down
Groupie
Groupie
Avatar

Joined: 01 May 2008
Location: United Kingdom
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote JerryEvans Quote  Post ReplyReply Direct Link To This Post Posted: 26 March 2009 at 7:24am
Oleg, thanks.

re the bitmap - the extra is that which VS always shows in its editor. There are 9 items defined in the toolbar. Why should the last two not display as bitmaps?

IDR_TOOLBAR_EDITOR TOOLBAR  16, 15
BEGIN
    BUTTON      ID_EDIT_SELECTALL
    BUTTON      ID_EDIT_UNDO
    BUTTON      ID_EDIT_REDO
    SEPARATOR
    BUTTON      ID_EDIT_FIND
    BUTTON      ID_FINDER_SEARCH
    SEPARATOR
    BUTTON      ID_EDIT_REPLACE
    BUTTON      ID_FINDER_REPLACE
    SEPARATOR
    BUTTON      ID_FINDER_MATCHCASE
    BUTTON      ID_FINDER_WHOLEWORD
END




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: 26 March 2009 at 2:00am
Hi,
 
1. Catch WM_XTP_INITCOMMANDSPOPUP it called when Popup become visible.
 
2. I see you have 9 buttons on toolbar but 10 in bitmap.
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
JerryEvans View Drop Down
Groupie
Groupie
Avatar

Joined: 01 May 2008
Location: United Kingdom
Status: Offline
Points: 39
Post Options Post Options   Thanks (0) Thanks(0)   Quote JerryEvans Quote  Post ReplyReply Direct Link To This Post Posted: 25 March 2009 at 9:52pm
Hello.

2 questions for the panel:

1. In my frame class I assemble a command bar whic creates a drop-down menu:

// views
    CXTPToolBar* pToolBarViews = pCB->Add(_T("Views"), xtpBarTop);
    if (pToolBarViews)
    {
        // set up the bitmap
        pCB->GetImageManager()->SetIcons(IDR_TOOLBAR_VIEWS);
        //
        pToolBarViews->SetBarID(IDR_TOOLBAR_VIEWS);
       
        CXTPControlPopup* p = (CXTPControlPopup*)
        pToolBarViews->GetControls()->Add(xtpControlButtonPopup,ID_VIEW_SELECT);
        if (p)
        {
            p->SetStyle(xtpButtonCaption);
            p->SetCaption("Select Views");
            CMenu menu;
            menu.LoadMenu(IDR_SYSTEM);
            // we are only interested the View submenu
            p->SetCommandBar(menu.GetSubMenu(1));
        }
        pToolBarViews->GetControls()->Add(xtpControlButton,ID_VIEW_CONCISE);

How can I dynamically modify the menu?

I have mapped an event handler like this:

    ON_XTP_EXECUTE(ID_VIEW_SELECT,OnExecuteViewSelect)

with an implementation as below:

void CAppDoc::OnExecuteViewSelect(NMHDR* pNMHDR, LRESULT* pResult)
{
    NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;
    if (tagNMCONTROL)
    {
        CXTPControlPopup* pControl = (CXTPControlPopup*)tagNMCONTROL->pControl;
        if (pControl)
        {
            DBMSG(CMsg("OnExecuteViewSelect"));
        }
    }
}

but it is never called. The XTP_EXECUTE works fine for combo box controls on similiar toolbars.

I'd hope to get a pointer to a CMenu or similar and then add/delete/modify the menu items as appropriate in the context. So far nothing seems to work.

BTW The event handlers for each of the IDR_SYSTEM submenus are called  ...

2. Toolbar bitmaps - 2 toolbars created in the same manner behave differently. The problem is that a toolbar with a mixture of button and combo controls refuses to display the bitmaps for the final 2 controls created with:

pTBE->GetControls()->Add(xtpControlButton,ID_FINDER_MATCHCASE);

What I see is shown below (excuse the rubbish graphics - I've yet to work out why the bitmap is always rendered as 8bpp):



Here is a snap of the original in the VS2008 editor - both toolbars have 9 elements and are 16pixels wide by 15 pixels high ...



Any help greatly appreciated.

This all being performed with VS2008 SP1 running on XPSP3 using XTP 1202

Thx++

Jerry

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