Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - Hiding "Add or Remove Buttons" from expand button
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Hiding "Add or Remove Buttons" from expand button

 Post Reply Post Reply
Author
Message
lfoster View Drop Down
Groupie
Groupie


Joined: 26 April 2010
Status: Offline
Points: 11
Post Options Post Options   Thanks (0) Thanks(0)   Quote lfoster Quote  Post ReplyReply Direct Link To This Post Topic: Hiding "Add or Remove Buttons" from expand button
    Posted: 28 April 2010 at 5:35am
There was a post in the ActiveX / COM forum asking the same thing but I thought maybe the solution they were using was different as I have tried it with no success. For ref see http://forum.codejock.com/forum_posts.asp?TID=16196

They suggested using the bShowExpandButtonAlways option of the command bars but I tried this and I just get the usual expand button with the "Add or Remove Buttons" menu item.

I want to just have the expand button with nothing but the toolbar buttons that didn't fit on the toolbar itself.

Can anyone help?

Thanks,

Lewis
Back to Top
sunceenjoy View Drop Down
Groupie
Groupie


Joined: 16 April 2010
Location: China
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote sunceenjoy Quote  Post ReplyReply Direct Link To This Post Posted: 07 May 2010 at 12:12am

do you mean to hide the expending menu??

 

Call this method to show/hide expand button of toolbar

void ShowExpandButton(
    BOOL bShowExpandButton
);
Back to Top
elmue View Drop Down
Groupie
Groupie


Joined: 05 June 2010
Location: Germany
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote elmue Quote  Post ReplyReply Direct Link To This Post Posted: 05 June 2010 at 7:01pm
Hello

This answer is wrong.

Like Ifoster I also want to remove the "Add or remove buttons" menu entry WITHOUT removing the icons that don't fit into the toolbar.
But
pCommandBar->ShowExpandButton(FALSE);

removes BOTH!

This is not what I want



Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 07 June 2010 at 2:30pm
You can do something like this:

Private Sub CommandBars_InitCommandsPopup(ByVal CommandBar As XtremeCommandBars.ICommandBar)
    On Error Resume Next
        CommandBar.Controls.Find(, XTP_ID_CUSTOMIZE_ADDORREMOVE, , True).Visible = False
End Sub

OR if you still want the expand button displayed all the time, but don't want add\remove:

Private Sub CommandBars_InitCommandsPopup(ByVal CommandBar As XtremeCommandBars.ICommandBar)
    On Error Resume Next
        CommandBar.Controls.Find(, XTP_ID_CUSTOMIZE_ADDORREMOVE, , True).Visible = False
        If Not CommandBar.Controls.Find(, XTP_ID_CUSTOMIZE_ADDORREMOVE, , True).Visible Then
            If CommandBar.Controls.Count = 1 Then
                CommandBar.Controls.Add xtpControlLabel, 1234, "No Options Available", , True
            End If
        End If
End Sub
Back to Top
SuperMario View Drop Down
Admin Group
Admin Group
Avatar

Joined: 14 February 2004
Status: Offline
Points: 18057
Post Options Post Options   Thanks (0) Thanks(0)   Quote SuperMario Quote  Post ReplyReply Direct Link To This Post Posted: 07 June 2010 at 2:38pm
You need something like this for MFC version (untested code)

BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
...
    ON_XTP_INITCOMMANDSPOPUP()
...
END_MESSAGE_MAP()
...
afx_msg void OnInitCommandsPopup(CXTPPopupBar* pComandBar);
...
void CMainFrame::OnInitCommandsPopup(CXTPPopupBar* pCommandBar)
{
    // get the list of commands for the popup.
    CXTPControls* pCommandList = pCommandBar->GetControls();

    // Remove "Add\Remove" menu item from the File menu.
    CXTPControl* pCommandNew = pCommandList->FindControl(
        xtpControlButton, XTP_ID_CUSTOMIZE_ADDORREMOVE, TRUE, FALSE);
    if (pCommandNew)
    {
        pCommandList->Remove(pCommandNew);
    }
}


Back to Top
elmue View Drop Down
Groupie
Groupie


Joined: 05 June 2010
Location: Germany
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote elmue Quote  Post ReplyReply Direct Link To This Post Posted: 08 June 2010 at 12:11am
Have a look for a more detailed discussion of this topic in this manual:
How to create a fixed toolbar
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.