Print Page | Close Window

How to add a drop down arrow ?

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


Topic: How to add a drop down arrow ?
Posted By: Louis
Subject: How to add a drop down arrow ?
Date 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.




Replies:
Posted By: Louis
Date 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.



Posted By: Louis
Date 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);

        ...
    }

}



Posted By: Oleg
Date 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


Posted By: Louis
Date 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.



Posted By: Oleg
Date 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



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