StrataFrame Forum

Wizard page isn't showing broken rules

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

By Greg McGuffey - 8/24/2007

I have a WizardPage with a BO on it. The BO has a single field set as required. When add a new record and then try to immediately save it (thus the required field isn't provided) it just ignores the save. I.e. it won't let me save it with the broken rule (I presume), which is good.



What's missing is the error provider letting the user know why it can't be saved. The wizard page is part of a wizard that is on a form. Do I have to take some extra steps to get the error provider to show up? Or is this in the "you gotta do that one yourself" category?
By StrataFrame Team - 8/27/2007

It could call into the "you'll have to do this one yourself" category, but the WizardControl also has a collection of BOTranslations.  Basically, the error provider and the red InfoBox showing the number of broken rules is handled by the form, and the same logic does not exist on the WizardControl, so to get the business object to belong to both the wizard control and the form, you'll have to drop one on the form and use the BOTranslations to link the two together.
By Greg McGuffey - 8/27/2007

OK, I understand what the BOTranslations do, but not how. I see that there is a source and a destination object, but they are just strings. How does this work?



I have dropped a BO of the appropriate type on my main wizard form. I add the wizard page programmatically when the form loads, so I don't have the option of setting this through the designer. I have no idea what I'm supposed to put in those two fields. Help...please Blink



BTW, I tried to find the section in the book form training (I remember talking about this in class), but couldn't find it....the book really, really, really need a TOC or index Crazy
By Greg McGuffey - 8/27/2007

OK, I had the brilliant idea of looking at the ChildForm sample, since it uses BOTranslations. It appears that BOTranslations use reflection. Is that right?



I ask because obfuscation will break things if this is the case.
By StrataFrame Team - 8/28/2007

Yes, it uses reflection, and yeah, since you obfuscate your public types between your assemblies, it will change them so that they do not match the strings.  But, looking at the code, it should still be able to aquire an error provider to use.  Check in the watch window what the value of your businessObject._ParentForm is and also businessObject.ParentForm.
By Greg McGuffey - 8/28/2007

OK, so assuming I can get the parent form reference, how would I trigger the parent form to handle the broken rules?
By StrataFrame Team - 8/29/2007

The ParentForm will have a BusinessObjects collection.  Check that collection to see if it contains your business object and if it doesn't, then call ParentForm.AddBusinessObject(bo).  That should add the necessary handlers to the BusinessRulesChecked events and so forth to allow the broken rules to be displayed.
By Greg McGuffey - 8/29/2007

Ah, cool. BigGrin Thanks!
By StrataFrame Team - 8/30/2007

Let me know if the BusinessObjects collection already contains the BO (meaning that wasn't your issue) because there are a few other things we can try.