Managing Control Editing State
 
Home My Account Forum Try It! Buy It!
About Contact Us Site Map
StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Managing Control Editing StateExpand / Collapse
Author
Message
Posted 02/02/2008 6:02:08 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 11:10:36 AM
Posts: 355, Visits: 1,720
I'm creating a workflow application and one of the requirements is that the ability to edit individual fields of an object varies depending on the current status of the object in the workflow. This can be done in in the UI but I'm looking for a way to manage it at the BO level and let the SF data binding handle the read only state of the fields on the form. Is this doable? I've tried setting the BindingEditable property of the bound control to false but that didn't work. I also took a look at the ProperyDescriptor but didn't find anything that would work.

-Larry

Post #13966
Posted 02/02/2008 6:43:36 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 11:10:36 AM
Posts: 355, Visits: 1,720
OK after a little more experimenting I found that the BindingEditable property is observed if the IgnoreManagedReadOnlyState for the control is set to True; so I can get the behaviour I'm looking for by setting both properties at the BO level.

Which leads to another question; my knowledge of system.predicate is pretty much zero. How do I find the index of a bound control in the BoundControls collection given the field name?

-Larry

Post #13967
Posted 02/05/2008 10:41:26 AM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 11:13:06 AM
Posts: 4,104, Visits: 4,176
Sorry for the delay on this...I missed this post.  You could create a method to enumerate through the bounds controls.  To cycle through the collection, just do this.  You can then type of the "item" as a control to changed the editing state if you ned to.

For Each Item As MicroFour.StrataFrame.UI.Windows.Forms.IBusinessBindable In Me.BoundControls
       If Item.BindingField.Equals("MyFieldName", StringComparison.OrdinalIgnoreCase) Then
           CType(Item, System.Windows.Forms.Control).Enabled = False
       End If
Next
Post #14017
Posted 02/05/2008 2:29:21 PM


StrataFrame User

StrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame UserStrataFrame User

Group: StrataFrame Users
Last Login: Yesterday @ 11:10:36 AM
Posts: 355, Visits: 1,720
Thanks for the explanation; that's basically what I ended up doing. I was just wondering if there was a better way then simply looping through the collection. 

To get the functionality I was looking for I ended up subclassing BusinessLayer, created a list of NonEditableFields, and added methods to Add, Delete, and Clear the list. As the list is updated I update the BoundControls and refresh the Field/s. However since I also want to reference the field names using the field enums generated by SF, things got a little messy since to do that I have to add shadow methods to the inherited BO that in turn call the methods in my custom BusinessLayer. I solved that by creating my own custom template and adding it to visual studio.

Which brings me to; it would be nice if SF provided this functionality, so I wouldn't have to mess with custom templates. Also the logic could be combined with ManagedReadOnlyState which would be a cleaner solution. Or maybe there is a simpler solution that I haven't thought of.

Post #14040
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 5:46pm

Powered By InstantForum.NET v4.1.4 © 2008
Execution: 0.109. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.