CommandBarPopup...

Add-in Express™ Support Service
That's what is more important than anything else

CommandBarPopup...
How to emulate Outlook Icon+CommandBarPopup similar to the New button. 
Jeff Gilbert




Posts: 36
Joined: 2006-03-31
Would it be possible to use a CommandBarButton and have a context menu dropdown precisely below it like a popup menu? Does anyone have any example code for something like this? I need to be able to display an Icon+Caption on the button with a menu dropping down when clicked.
Posted 13 Oct, 2006 03:02:02 Top
Jeff Gilbert




Posts: 36
Joined: 2006-03-31
This is an example of what I'm hoping to achieve...
The first picture shows what looks like a regular CommandBarButton with an icon.
User added an image
The next pic shows it after you click. It has the dropdown menu.
User added an image

Is there any way to achieve this with ADX?
Posted 13 Oct, 2006 03:38:37 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Jeff.

Yes, it is possible with ADX.
Please download an example:
http://www.add-in-express.com/projects/olpopupwithimage.zip
Posted 13 Oct, 2006 09:36:48 Top
Jeff Gilbert




Posts: 36
Joined: 2006-03-31
I'm impressed with your service!
Thanks Sergey!
Posted 13 Oct, 2006 13:15:14 Top
Jeff Gilbert




Posts: 36
Joined: 2006-03-31
I've got one problem. The events aren't firing for my buttons? The dropdown shows, but when I click any of the buttons the Click handlers aren't firing. I may have made a conversion mistake going from the example c# code to vb.net. Did I convert it correctly? I'm pretty weak on C#.

Your C# Example
        private void adxCommandBarButton1_Click(object sender)
        {
            (adxCommandBar1.CommandBarObj as Microsoft.Office.Core.CommandBar).
                ShowPopup(adxCommandBarButton1.Left, adxCommandBarButton1.Top + adxCommandBarButton1.Height);
        }


My VB.NET Conversion of that code
        Private Sub cmdAdSwiftMain_Click(ByVal sender As Object) Handles cmdAdSwiftMain.Click
        AdxCommandBar1.CommandBarObj.ShowPopup(cmdAdSwiftMain.Left, cmdAdSwiftMain.Top + cmdAdSwiftMain.Height)
    End Sub
Posted 13 Oct, 2006 13:47:45 Top
Jeff Gilbert




Posts: 36
Joined: 2006-03-31
I tried adding a click handler on one of the buttons in your example with a MessageBox and that doesn't seem to be firing either... :(
Posted 13 Oct, 2006 14:13:30 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Jeff.

What version of VS do you use? Do you add events via the designer in VS?
Posted 16 Oct, 2006 07:51:50 Top
Jeff Gilbert




Posts: 36
Joined: 2006-03-31
I'm using VS 2003 for this project. And I believe I used the dropdowns in the designer to generate the Click event handlers.

Note: I ended up purchasing the Toolbars addin from you guys over the weekend. I dropped a Janus command button in there with a Janus dropdown menu and it's working great. However, it seems that the Toolbar container affects the Janus control somewhat. The Janus button let's you set gradient colors for the various button states, Up, Hover, down etc... The button wouldn't show the gradients when inside the Toolbar but with the same settings on a regular form it would show the gradients. The other part was the Janus button doesn't always seem to catch the Mouse leave event. I imagine that's because the boundries of the Toolbar container are so thin it makes it hard to catch the mouse leaving the control sometimes.
Posted 16 Oct, 2006 12:35:45 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi Jeff.

Doesn the Click event of the ADXCommandBarButton component work if you add it via the dropdown in the designer?
Posted 17 Oct, 2006 09:39:50 Top
Jeff Gilbert




Posts: 36
Joined: 2006-03-31
No that was the strange thing... The Main drop down button was firing and triggering the code to show the context menu, but the click events on the context menu weren't firing.
Posted 17 Oct, 2006 14:18:02 Top