Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - FindControl on Popup Menus
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

FindControl on Popup Menus

 Post Reply Post Reply
Author
Message
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Topic: FindControl on Popup Menus
    Posted: 25 May 2006 at 10:30am
I am having trouble with the FindControl method on a popup menu using the following code:

Dim Control As CommandBarControl

    Set Popup = CommandBars.Add("Popup", xtpBarPopup)
   
    With Popup.Controls
        Set Control = .Add(xtpControlPopup, 0, "Send To...", -1, False)
        Control.Id = 200
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOPRODUCTION, "Production", -1, False
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOBARCODESERVER, "Barcode Server", -1, False
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOENHANCESERVER, "Enhance Server", -1, False
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOIMPORTSERVER, "Import Server", -1, False
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOBILLING, "Billing", -1, False

    End With

CommandBars.ActiveMenuBar.FindControl(, ID_SENDTOBILLING, , True).Visible = True


FindControl always returns nothing, even if I replace ID_SENDTOBILLING with 200.

Help please!

Thanks
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 25 May 2006 at 5:09pm
I should probably add that I am using version 10.1.1
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 May 2006 at 9:53am

yes, this is thing.

CommandBars.Add + xtpBarPopup actually just create popup bar to show it, but not add it to CommandBars collection, so FindControl will return Nothing.

 

use CommandBars.Add + xtpBarPopup only if you need to show context menu.

If you need to add popup bar for menu bar call

Set ControlFile = CommandBars.ActiveMenuBar.Controls.Add(xtpControlPopup, 0, "&File", -1, False)
 

 

 

Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 26 May 2006 at 10:15am
I am using xtpBarPopup for the purpose of showing a context menu when I right click on a grid.  I'm not using a menu bar at all in this case.  So, I'm still lost.
Back to Top
jcollier View Drop Down
Senior Member
Senior Member


Joined: 15 February 2006
Status: Offline
Points: 250
Post Options Post Options   Thanks (0) Thanks(0)   Quote jcollier Quote  Post ReplyReply Direct Link To This Post Posted: 31 May 2006 at 3:55pm
Help.  Please.  I'm stumped.
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: 31 May 2006 at 4:02pm
He is saying that xtpBarPopup will not be added to the commandbars controls collection, they are "temporary".

If you want to use your same code you could use some logic before adding the button.

For example:

Dim Control As CommandBarControl
Dim x as CommandBarControl

    Set Popup = CommandBars.Add("Popup", xtpBarPopup)
   
    With Popup.Controls
        Set Control = .Add(xtpControlPopup, 0, "Send To...", -1, False)
        Control.Id = 200
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOPRODUCTION, "Production", -1, False
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOBARCODESERVER, "Barcode Server", -1, False
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOENHANCESERVER, "Enhance Server", -1, False
        Control.CommandBar.Controls.Add xtpControlButton, ID_SENDTOIMPORTSERVER, "Import Server", -1, False
        Set x = Control.CommandBar.Controls.Add(xtpControlButton, ID_SENDTOBILLING, "Billing", -1, False)
    x.Visible = bSomeCondition

    End With

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