Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - How to add a drop down arrow ?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

How to add a drop down arrow ?

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


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post Topic: How to add a drop down arrow ?
    Posted: 17 August 2005 at 1:35pm

What are the steps to add a drop down arrow to a toolbar button ?

I have been looking at the samples and did'nt see any using this, maybe I missed it. Can someone tell me what sample has it or describe the stpes here. Also how to get notification to react.

thanks,
LOuis.

Back to Top
Louis View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post Posted: 17 August 2005 at 4:05pm

ok, I managed to get a drop down arrow. Find it by looking at the GUI_VisualStudio7 sample. Taking a lot of time to figure out things juts by looking at samples. Wish the doc had more info on key features like this one.

Now, I need to know how to display a popup menu when the arrow is clicked. The popop menu must be DYNAMICALLY built.

thanks,
Louis.

Back to Top
Louis View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post Posted: 17 August 2005 at 9:30pm

Ok, now I got the toolbar button menu to be filled up. Oleg, I just need to know if what I did is a good way of doing this ?

//Populate dynamically a toolbar button's drop down menu:

void CMainFrame::OnInitCommandsPopup(CXTPPopupBar* pCommandBar)
{
    CXTPControlPopup *pPopup = pCommandBar->GetControlPopup();

    int nPopupID = pPopup->GetID();

    if( nPopupID == ID_VIEW_GRAPH )
    {
        CXTPControls* pControls = pCommandBar->GetControls();
        pControls->RemoveAll();

        //Fill items
        pControl = pControls->Add(xtpControlButton, ID_GRAPH1, _T(""), i, TRUE);
        pControl->SetCaption(csCaption);

        ...
    }

}

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 18 August 2005 at 4:08am

Yes, code is ok, but better use code from DynamicPopups

see

CControlFavorites::OnCalcDynamicSize(..)

{

...

}

because it will allow to customize this popup by user - to add/remove some buttons.

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
Louis View Drop Down
Newbie
Newbie


Joined: 17 August 2005
Status: Offline
Points: 19
Post Options Post Options   Thanks (0) Thanks(0)   Quote Louis Quote  Post ReplyReply Direct Link To This Post Posted: 18 August 2005 at 9:13am

Thanks oleg. I don't need this item to be customized. It is dynamically filled from a list of docking windows (title) that are used to display graphs. When the item is selected the focus is set to the proper commandbar.

One last question on this topic. To avoid creating control IDs and process them with standard message handling mechanism, I used the technique in the sample DynamicPopups for the favorite control. By using the message  map:

ON_XTP_EXECUTE(ID_VIEW_GRAPH_ITEM, OnViewGraphItem)

i can process the event for the item. To me it all works fine, I just hope it is a good way and no possible conflict. I am working on an existing MFC application that was using the toolbar notification message TBN_DROPDOWN and then using TrackPopupMenu to do this.

This way I don't need to create a control and use OnCalcDynamicSize. I just do it all in the MainFrame.

If using OnCalcDynamicSize is still a better way let me know.

many thanks,
Louis.

Back to Top
Oleg View Drop Down
Senior Member
Senior Member


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: 18 August 2005 at 1:21pm

Yes it can be used without problems.

 

ps. Glad you catch how all this work :)

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.