Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > ActiveX COM > Command Bars
  New Posts New Posts RSS Feed - Problem with CommandBarPopup.DeleteAll()
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with CommandBarPopup.DeleteAll()

 Post Reply Post Reply
Author
Message
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post Topic: Problem with CommandBarPopup.DeleteAll()
    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
Back to Top
Aaron View Drop Down
Senior Member
Senior Member
Avatar

Joined: 29 January 2008
Status: Offline
Points: 2192
Post Options Post Options   Thanks (0) Thanks(0)   Quote Aaron Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
blazej View Drop Down
Groupie
Groupie


Joined: 09 February 2005
Location: Canada
Status: Offline
Points: 53
Post Options Post Options   Thanks (0) Thanks(0)   Quote blazej Quote  Post ReplyReply Direct Link To This Post 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
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: 21 February 2008 at 3:15pm
CommandBarPopup popup = ...;
popup.CommandBar.Controls.DeleteAll();
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
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.174 seconds.