We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Change bar items by code

Thread ID:

Created:

Updated:

Platform:

Replies:

46495 Jul 13,2006 11:33 AM Jul 13,2006 04:42 PM Windows Forms 8
loading
Tags: Tools
Administrator [Syncfusion]
Asked On July 13, 2006 11:33 AM

Hello There, I used two XPMenu bars to display MainModule and SubModule menu items. I wrote following code to dynamically change the SubModule baritems when clicking on a MainModule item. In my code, I use ''barSubModule.Items.Clear();'' to clear old baritems. But it doesn''t work. The old baritems is still displaying with the new baritem appended behind them. I guess I need some kind refresh or so. Any idea? Thanks, Lan private void ResetSelectedModule(BarItem SelectedBarItem) { //get the selected submodule bar Bar barCurr = this.barHomeCategory; switch (SelectedBarItem.ID) { case "Home": barCurr = this.barHomeCategory; break; case "Sections": barCurr = barSectionCategory; break; case "Reports": barCurr = barReportCategory; break; case "Parameters": barCurr = barParameterCategory; break; case "Analysis": barCurr = barAnalysisCategory; break; case "Utility": barCurr =barUtilityCategory; break; } //clear old submodule items barSubModule.Items.Clear(); // add new submodule items for (int i=0;i

Administrator [Syncfusion]
Replied On July 13, 2006 12:20 PM

Hello There, I noticed this doesn''t work on MDI form. I attach a sample to you here. click File-->New, then click File-->Open, you can see it add up new baritems in without clear old ones. When you change the form to non-MDI form by changing the ISMDIForm property to false. It works. This is a urgent issue for me. Please help me get around it. Thanks. Lan >Hello There, >I used two XPMenu bars to display MainModule and SubModule menu items. I wrote following code to dynamically change the SubModule baritems when clicking on a MainModule item. In my code, I use >''barSubModule.Items.Clear();'' to clear old baritems. But it doesn''t work. The old baritems is still displaying with the new baritem appended behind them. I guess I need some kind refresh or so. >Any idea? >Thanks, >Lan > > private void ResetSelectedModule(BarItem SelectedBarItem) > { > > //get the selected submodule bar > Bar barCurr = this.barHomeCategory; > switch (SelectedBarItem.ID) > { > case "Home": > barCurr = this.barHomeCategory; > break; > case "Sections": > barCurr = barSectionCategory; > break; > case "Reports": > barCurr = barReportCategory; > break; > case "Parameters": > barCurr = barParameterCategory; > break; > case "Analysis": > barCurr = barAnalysisCategory; > break; > case "Utility": > barCurr =barUtilityCategory; > break; > } > //clear old submodule items > barSubModule.Items.Clear(); > // add new submodule items > for (int i=0;i { > barSubModule.Items.Add(barCurr.Items[i]); > } > > } >

Toolbar3.zip

Mano J [Syncfusion]
Replied On July 13, 2006 12:50 PM

Hi Lan, When MainForm is a MDI Container, MergedBars are used instead of original Bars.This is because of Bars from different MdiChild forms can be merged to a single Bar. You should get the MergedEquivalent of the Bar (barModule) and clear the items as shown below private void barItem1_Click(object sender, System.EventArgs e) { //new-barFile Bar bar = this.mainFrameBarManager1.GetMergedEquivalent(barModule, barModule); bar.Items.Clear(); for (int i=0;i

Administrator [Syncfusion]
Replied On July 13, 2006 01:13 PM

Hello Mano, Thanks for quick reponse. You''ve sovled my problem. Have a great day! Lan >Hi Lan, > >When MainForm is a MDI Container, MergedBars are used instead of original Bars.This is because of Bars from different MdiChild forms can be merged to a single Bar. > >You should get the MergedEquivalent of the Bar (barModule) and clear the items as shown below > >private void barItem1_Click(object sender, System.EventArgs e) >{ > //new-barFile > Bar bar = this.mainFrameBarManager1.GetMergedEquivalent(barModule, barModule); > bar.Items.Clear(); > > for (int i=0;i { > barModule.Items.Add(barFile.Items[i]); > } >} > >I have attached a modified sample. Please refer to it and let me know if you have any questions. > >Thanks for using Syncfusion products. > >Regards, >Mano > >http://www.syncfusion.com/Support/user/uploads/Toolbar_13cc4e92.zip >

Administrator [Syncfusion]
Replied On July 13, 2006 02:07 PM

Hello Mano, One more question. when a MDI form uses XPMenu bar, set auto save/load customizations properties like this: mainFrameBarManager1.AutoLoadToolBarPositions=true; mainFrameBarManager1.AutoPersistCustomization=true; Where does Sysnfuction store the customized size/location etc? Does it store in windows registry? I''ve not done any code to save or load them. I guess Sysnfuction does it automatically. The reason is that I got a machine always load the old-version application''s setting. The old-ver application allows user change the size/position of XPMenu bar, now the new version has size and position fixed. The application always load the customized XPMenu bars'' size and position. I guess that I need to delete the old customized settings,say in registry, manually? Is it right? Lan

Mano J [Syncfusion]
Replied On July 13, 2006 02:44 PM

Hi Lan, By default, Syncfusion XPMenus stores the Bar''s persisted state information into Isolated Storage folder (C:\Documents and Settings\\Local Settings\Application Data\IsolatedStorage\..). If you delete the files in this folder, it will restore the default settings. Please let me know if you have any questions. Regards, Mano

Administrator [Syncfusion]
Replied On July 13, 2006 03:10 PM

Hi Mano, In IsolatedStorage fold, there are a lot of subfolders. Does they all created by Syncfusion? Can I delete them all? Please see my attached folder image. Thanks, Lan >Hi Lan, > >By default, Syncfusion XPMenus stores the Bar''s persisted state information into Isolated Storage folder (C:\Documents and Settings\\Local Settings\Application Data\IsolatedStorage\..). > >If you delete the files in this folder, it will restore the default settings. > >Please let me know if you have any questions. > >Regards, >Mano

IsolatedStorage.zip

Mano J [Syncfusion]
Replied On July 13, 2006 03:48 PM

Hi Lan, The persisted state information are stored in a binary file named ''SyncfusionToolsStateInfo.bin'' under the files folder (see attached screenshot). You can delete this BIN file to remove the persisted information. Regards, Mano snap_1.zip

Administrator [Syncfusion]
Replied On July 13, 2006 04:42 PM

Hi Mano, Thanks, It works now. Lan

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;