StrataFrame Forum

MaintenanceFormToolbar question...

http://forum.strataframe.net/Topic2903.aspx

By StarkMike - 9/19/2006

I've created a SF DevExpress Maintenance form and I want to know if i could add my own buttons or what not to the MaintenanceFormToolbar.
By Trent L. Taylor - 9/19/2006

The problem is the DevExpress toolbars...I really don't like the way that they manage their bars at all.  You will not be able to add new buttons to the MaintenanceFormToolbar itself, but you can add another toolbar through the same BarManager control.  At present this is just the way it is with the DevExpress toolbars since we have to be able to control the buttons of the MaintenanceFormToolbar.  Sorry. Ermm
By StarkMike - 9/19/2006

Would it be possible to add buttons to the ToolStrip if I were using just a SF Maintenance form without the DevExpress stuff?
By Trent L. Taylor - 9/19/2006

Yes, but they would have to be at the very end.  They could not be injected between the existing button controls.
By StarkMike - 9/19/2006

Cool. Let me push a little further. BigGrin I noticed that if i add a button using the shortcut there on the toolstrip you're right I could not move my item to the left... however when i went into the items collection through the properties menu i was able to position my button wherever i wanted it.



I guess I'm asking why you're telling me I can't inject my buttons inbetween your standard items? Will it mess up the code because the indexes arent the same or what?



Thanks.Wink
By StrataFrame Team - 9/19/2006

No, the problem is the initialization order... the MaintenanceFormToolstrip has its own InitializeComponent() method that gets called when it is instantiated... inside this method, the standard buttons get added to the collection.  However, the buttons that you add to the toolstip get added in the form's InitializeComponent() method, which is called after the MaintenanceFormToolstrip's InitializeComponent() method.  So, the standard buttons have already been added to the toolstrip when your form goes to add the rest of the buttons, so your buttons get added to the end.  The designer will never generate the code to properly order the buttons.  However, the order of the buttons certainly does not matter, so you can add any code you want after the form's InitializeComponent() method (in the constructor) to order the buttons in any way you like, but you have to do it manually.
By StarkMike - 9/19/2006

Gotcha. Thanks Smile
By Vikram Saxena - 2/16/2007

Can you please tell me how can i set the index or order for the new button. i am asking you the property i should set for the new items (buttons) i added in the tool strip.



Thanks.
By Trent L. Taylor - 2/16/2007

You would have to do this at run-time.  The MaintenanceFormToolstrip is nothing more than a pre-built toolstrip control with some built-in functionality.  You can reference the Items collection and do anything you want.  ANything you do at design-time is going to be over-written due to the nature of the collection and how it is managed through .NET.