StrataFrame Forum

Two BO in one Form

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

By Alex Bibiano González - 3/14/2008

Ok, I have already created the basic maintenance forms from my first StrataFrame application, but now I have a different one and want to ask the best solution for creating it.

My new form, has a treelist (already populated with a BO). This treelist has 2 type of nodes (categories and accounts).

When the user click on an account, I want to display a panel with the fields from the Account BO and when he clicks on a category, I hide the account panel and display the category panel with the categories BO fields.

I have also an MaintenanceFormToolStrip.

What's the best approach to manager this two panels with his BO?

I think that changing the primarybussinesobject from the from every time the users clicks on an treelist item and retrieving the selected item in the business object can be the solution, but I'm not sure?

Thanks,

Alex B.

By Greg McGuffey - 3/14/2008

You would use the PanelManager (a SF control) to host the two panels. You could then simply activate the desired panel based on the node clicked in the tree. I think the method is ActivatePage() on the PanelManager itself. The PanelManager greatly simplifies the design experience so you don't have to muck around with moving panels all over the place to design them or to building the panel in code.



I had never thought to switch the PrimaryBO of the form to get the maintenanceformtoolstrip to work with two BOs...let us know how that works. It sounds promising. BigGrin



If it doesn't, you could pretty easily just roll you own toolstrip that would save to the correct BO based on the node selected.
By Trent L. Taylor - 3/14/2008

Yup, Greg nailed it Smile
By Greg McGuffey - 3/17/2008

I think the method is ActivatePage() on the PanelManager itself.




I was wrong...did this last Friday after posting this and the above mentioned method is wrong (way wrong :blushSmile. You actually use the .CurrentPage property. Just set it to the page that you want to show.
By Trent L. Taylor - 3/17/2008

Or call the SetActivePage method Smile  Yeah, I missed that on your previous post.  Good call.
By Greg McGuffey - 3/17/2008

SetActivePage()...OK, I wasn't hallucinating Crazy. I've used that too! Tongue
By Robin J Giltner - 3/17/2008

Yeah SetActivePage.  Also, on our main form that has around 13 BusinessObjects I have a Case statement that switches the Form's PrimaryBusinessObject depending on which node type the user has clicked on (around 25 node types) so that the MaintenanceFormToolStrip buttons work properly with whichever record in whichever BusinessObject they want to work on.  I put the code to choose which BO is the PrimaryBO in the MaintenanceFormToolStrip ClickEvent. Not sure if that is the best place for it, but it works for out app.

Hope this helps.

Robin Giltner