Print Page | Close Window

Problem with CommandBarPopup.DeleteAll()

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=9661
Printed Date: 08 October 2024 at 8:33am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Problem with CommandBarPopup.DeleteAll()
Posted By: blazej
Subject: Problem with CommandBarPopup.DeleteAll()
Date Posted: 21 February 2008 at 1:25pm
Hello,

I have a CommandBarPopup on my main menu. I want to remove all items that belong to the popup (i.e. all siblings), and add new ones. Here's what my code does:

CommandBarPopup popup = ...;
popup.Controls.DeleteAll();
popup.Controls.Add( ... );

The problem is that after the call to DeleteAll, popup.Controls becomes null! Am I missing something?

Best,
Michal Blazejczyk



Replies:
Posted By: Aaron
Date Posted: 21 February 2008 at 2:53pm
Hi,
 
You better use the InitCommandsPopup event. 
 
Private Sub CommandBars_InitCommandsPopup(ByVal CommandBar As XtremeCommandBars.ICommandBar)
       CommandBar.Controls.DeleteAll ''this will delete all siblings
       CommandBar.Controls.Add(xtpControlButton, ID_BUTTON1,"caption") ''this will add a new button to the popup
End Sub


Posted By: blazej
Date Posted: 21 February 2008 at 3:02pm
Good idea. I will try this.

But still, it would be interesting to know why my code does not work as is...

Best,
Michal


Posted By: Oleg
Date Posted: 21 February 2008 at 3:15pm
CommandBarPopup popup = ...;
popup.CommandBar.Controls.DeleteAll();


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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