StrataFrame Forum

MaintenanceToolStrip Problem/Question

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

By fansanitis - 1/16/2008

I've created a form whose purpose is to maintain a number of tables.  I'm using a ThemedLinkMenu for table selection and a PanelManager with a separate page for each table.  On each page I placed a MaintenanceToolStrip control.  For the 1st page it works fine but all subsequent page's toolstrips are also "bound" to the primary business object.  Is there anyway to bind each MaintenaceFormToolStrip to a separate business object?  Or is there a better way to design the app where each "page" would be it's own form and thus have it's own primary business object?  Displaying child forms in the area now occupied by the panelmanager?

Thanks!!

By Greg McGuffey - 1/16/2008

The MaintenanceFormToolstrip only works with the PrimaryBO of the form (a property of the form and usually the first BO added to the form). You'll have to roll you own tool strip to handle this scenario. Not too hard, just add buttons for the desired functionality and then just call methods on the associated BO (make your own custom control) and add a public BusinessObject property of type BusinessLayer.



Good luck!
By Trent L. Taylor - 1/16/2008

The MaintenanceFormToolstrip actually doesn't only use the Primary BO....by default the IncludeInForm...  settings are set to Add, Edit, Delete, and Navigate the Primary BO.  However, the Save is pre-set to save all dirty BOs on the form.  You can use the IncludeInForm... settings on the form and BOs to determine which BOs will be respected.

However, to address your current situation, I might take a different approach.  We do this very same thing often and in our medical software, actually, and create a separate toolstrip (not a maintenance for toolstrip) for each page.  We also do not use the "edit" mode in many cases.  There is an event called IsDirtyChanged that is raised when any data within the BO is changed.  When this fires, we have a method called SetToolstrip (or something of that nature) that updates the toolstrip buttons accordingly (in this case Save/Undo we become enabled).  In fact, we actually have another section that uses another ThemedLink menu as links and the Save and Undo appear within that link menu instead of a toolstrip at all.  So there are a lot of different ways to go about this...but the MaintenanceFormToolstrip, though you could make it work in this scenario, may not be the best solution for what you are trying to accomplish...just a few ideas Smile

Greg is right though...you may want to incorporate your own control or toolstrip in this scenario.

By fansanitis - 1/17/2008

Thanks for the advice guys!!  This there a sample anywhere that implements a toolstrip with Add/Save/Undo/Delete functionality?
By Greg McGuffey - 1/17/2008

Check out the tutorial. There is a page on navigation and on saving etc. It's pretty easy. I'd likely make a user control, add a public property for a BO, add the toolstrip and buttons....done.



I do like the idea of using the themed link menu though and skipping the tool bar...I'm going to look into that.
By Greg McGuffey - 1/17/2008

We also do not use the "edit" mode in many cases. There is an event called IsDirtyChanged that is raised when any data within the BO is changed. When this fires, we have a method called SetToolstrip (or something of that nature) that updates the toolstrip buttons accordingly (in this case Save/Undo we become enabled).




Are you saying that the form is just automatically in edit mode? How do you do this? Set the Ignore(BO State...can't remember the property name) to True on the controls? Or do you just automatically turn on editing, then manage it? Sounds intriguing, but I'm confused....Blink
By Trent L. Taylor - 1/17/2008

Whoa there....it isn't that complicated BigGrin  To play with this, create a sample application that talks to the StrataFrameSample database (or something).  Create a BO (CustomersBO) and drop it on the form and set it up as though you would any other BO and bind it to your text boxes, etc.

Set the ManageUIReadOnlyState of the BO to False...this will leave the bound controls in an editable state.  Then add a handler to the IsDirtyChanged event of the BO....when it changes, set your Save/Undo buttons enabled state based off of the CustomersBO.IsDirty property.  It is pretty much that simple Smile

By Greg McGuffey - 1/17/2008

So, because the controls are bound to the BO, any changes to them affect the underlying datatable? Which would mean that the editing state is more about the UI than the data? (just trying to learn more about my favorite framework) BigGrin
By Trent L. Taylor - 1/17/2008

So, because the controls are bound to the BO, any changes to them affect the underlying datatable?

You got it Wink

Which would mean that the editing state is more about the UI than the data?

Now you've got the picture!

(just trying to learn more about my favorite framework)

Ahhh...you're making me blush Blush

By Greg McGuffey - 1/17/2008

Cool! Thanks!