StrataFrame Forum

How to allow scrolling in a readonly text box

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

By Greg McGuffey - 11/10/2006

I have lots of instances where I have a textbox that will have more text than can be displayed in the viewable area. When the textbox is bound to a BO field, the only way to be able to scroll (that I've figure out) is to edit the text. Obviously this won't work when the user has readonly access. How do I allow scrolling and keep the field readonly?
By Trent L. Taylor - 11/11/2006

You can set the the IgnoreManageReadonlyState property on the textbox to True, set the Readonly property on the textbox to True and there you go...Smile
By Greg McGuffey - 11/13/2006

OK, but this means I have to manually react to all of the appropriate events to manage the readonly stat right? What I'm saying is that the user will want to be able to read all of the text when it is readonly, but when they hit edit, they can edit it. What events do I need to react to? Or what part of the SF code should I look at so I can figure out how to recreate what you are providing, albeit with a slightly different functionality for when the textbox is readonly?
By StrataFrame Team - 11/13/2006

If you want to control the functionality within the form, then you will need to handle the EditingStateChanged event of the business object.  If the stat is Idle, then change the controls to ReadOnly, otherwise, set them to editable. 

However, if you want to control this from within the controls themselves, you will need to create your own textbox.  The easiest thing would be to copy the source code for the textbox within the StrataFrame source code to your own textbox class and change the BindingEditable property to alter the ReadOnly property, not the Enabled property.

By Greg McGuffey - 11/13/2006

Cool. That sound both doable and no much extra work. Thanks!
By StrataFrame Team - 11/13/2006

Good to hear... Also, if you are using a 3rd party control suite like DevExpress or Infragistics, you can just change the disabled colors of the controls.

The reason we went with disabled instead of read-only is that only the textbox has a ReadOnly property... so all of the other controls looked rather strange when only the textboxes were ReadOnly and all of the others were disabled.