![]() |
How to delete menu item using parent |
Post Reply ![]() |
Author | |
sandy eggo ![]() Newbie ![]() Joined: 14 November 2007 Location: Albania Status: Offline Points: 1 |
![]() ![]() ![]() ![]() ![]() Posted: 14 November 2007 at 5:27pm |
I have an app that dynamically adds menu items based on the contents of a directory. Sub-Directories are added to the menu as sub-menu popups and files are added as menu items. My problem is that when the user elects to re-load the menu I have to remove all the dynamically added menu items without removing the compile-time menu items. So the problem is that I can't delete the empty menus after the sub items have been deleted.
See the following code. The problem is the last line:
XtremeCommandBars.CommandBarControl foundMenuItem = null; // check to see if the custom menu item exists in the FTM Commands menufoundMenuItem = ControlMode.CommandBar.FindControl(
XTPControlType.xtpControlButton, IDNum, true, true ); if( foundMenuItem != null ){ // get the parent menu of the found item for future checkXtremeCommandBars.CommandBar parentMenu = (XtremeCommandBars.CommandBar)foundMenuItem.Parent; // delete the item from the menufoundMenuItem.Delete(); // delete the parent menu if there are no items left in it if( parentMenu.Controls.Count <= 0 ){ parentMenu.Delete(); // THIS DOESN'T WORK}
|
|
sandy eggo
|
|
![]() |
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 |