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.

ChildFrameBarManager

Thread ID:

Created:

Updated:

Platform:

Replies:

58772 Mar 28,2007 04:12 AM Apr 19,2007 10:05 AM Windows Forms 3
loading
Tags: Tools
Dimitar Milov
Asked On March 28, 2007 04:12 AM

Hi,

How can I modify command bars of the childFrame window in MDITabbed application during run-time. For exapmle i want to remova one item from my childframe toolbar and to add new - how can i do this.

Thank You!

Venugopal M [Syncfusion]
Replied On March 30, 2007 07:02 AM

Hi Dimitar,
We can modify the command bars of child frame window using its object reference from the mainframe. The following code snippet will give detail idea about runtime add/remove barites from the XPToolbar of child Frame.


(All the code snippet should be in mainFrame)

Adding bar Items in XPToolbar of Child Frame.

// get all the child references
Form[] forms=this.MdiChildren;
foreach (Form f in forms)
{
// get xptoolbar object reference.
XPToolBar xp = f.Controls["xpToolbar1"] as XPToolBar;

// New baritem
BarItems bitems = xp.Bar.Items;
BarItem mybaritem = new BarItem("NewBar");
mybaritem.CategoryIndex = 0;
mybaritem.ID = "NewBar";
mybaritem.PaintStyle =Syncfusion.Windows.Forms.Tools.XPMenus.PaintStyle.TextOnly;
mybaritem.Text = "NewBar";

// adding new bar item into xptoolbar.
xp.Bar.Items.Add(mybaritem);
}

Removing BarItem from the XPToolbar of ChildFrame


// get all the child references
Form[] forms=this.MdiChildren;
foreach (Form f in forms)
{
// get xptoolbar object reference.
XPToolBar xp = f.Controls["xpToolbar1"] as XPToolBar;
BarItems bitems = xp.Bar.Items;

//Removing baritem using its id.
xp.Bar.Items.Remove(xp.Items.FindItem("&Undo"));
}

This code will add and remove the baritem in XPToolbar from all the childFrame. If you need particular childframe operation just you can check the childframe reference inside of loop then you could allow add/remove.

Thank you for interest in Syncfusion products.

Please Let me know if you have any queries.

Thanks ,
Venugopal M.

Dimitar
Replied On April 2, 2007 07:22 AM

Hi, I'm using BarManagers and automerging. In this case I should change the ChildFrameBarManager items and should remerge ChildFrameBarManager with the MainFrameBarManager. I'm doing this by calling UnregisterMdiChildTypes and then against calling RegisterMdiChildTypes.

RegisterMdiChildTypes creates dummy instance of my type which contains all changes in the menus and toolbars, but do not merges by some reason.....
I suppose that it uses childFrameBarManager of my current childframe instance.

If there is some way to remerge all toolbars and menus for all childframes of the same type I'll solve my problem.

Thank You!

Golda Rebecal [Syncfusion]
Replied On April 19, 2007 10:05 AM

Hi Dimitar,

Sorry for the delay in responding.

I have attached a sample that shows how to remove a baritem from the child form and add a new bar item dynamically.

Please have a look at the attached sample and let me know if this meets your requirement.

Thanks for your interest in Syncfusion products.

http://websamples.syncfusion.com/samples/tools.Windows/F58772/main.htm

Best regards,
Golda

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.

;