FindControl on Popup Menus |
Post Reply |
Author | |
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
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 |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
I should probably add that I am using version 10.1.1
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
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 |
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
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.
|
|
jcollier
Senior Member Joined: 15 February 2006 Status: Offline Points: 250 |
Post Options
Thanks(0)
|
Help. Please. I'm stumped.
|
|
SuperMario
Admin Group Joined: 14 February 2004 Status: Offline Points: 18057 |
Post Options
Thanks(0)
|
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 |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |