Print Page | Close Window

FindControl on Popup Menus

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=4279
Printed Date: 03 November 2024 at 8:25am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: FindControl on Popup Menus
Posted By: jcollier
Subject: FindControl on Popup Menus
Date 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



Replies:
Posted By: jcollier
Date Posted: 25 May 2006 at 5:09pm
I should probably add that I am using version 10.1.1


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


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


Posted By: jcollier
Date Posted: 31 May 2006 at 3:55pm
Help.  Please.  I'm stumped.


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




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