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. Image for the cookie policy date
close icon

ChildFrameBarManager

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!

3 Replies

VM Venugopal M Syncfusion Team March 30, 2007 11:02 AM UTC

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.


DI Dimitar April 2, 2007 11:22 AM UTC

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!


GR Golda Rebecal Syncfusion Team April 19, 2007 02:05 PM UTC

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

Loader.
Live Chat Icon For mobile
Up arrow icon