﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » WinForms (How do I?)  » Change control disabled state to readonly</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Wed, 16 Sep 2026 05:14:19 GMT</lastBuildDate><ttl>20</ttl><item><title>Change control disabled state to readonly</title><link>http://forum.strataframe.net/FindPost25610.aspx</link><description>Hi,&lt;br&gt;
The default behavior of controls when editable state of business object is false - controls are disabled. &lt;br&gt;
When it so, I can't use shortcut menu to copy text values and so on. The question is :&lt;br&gt;
Is there EASY WAY :) to change controls behavior so controls instead disable set to readOnly. &lt;br&gt;
&lt;br&gt;
Thank you &lt;br&gt;
Denis&lt;br&gt;</description><pubDate>Thu, 28 Jan 2010 18:20:34 GMT</pubDate><dc:creator>dgsoft</dc:creator></item><item><title>RE: Change control disabled state to readonly</title><link>http://forum.strataframe.net/FindPost25647.aspx</link><description>If you just want the controls to always be enabled, then Trent's suggestion is very easy. &lt;br&gt;
&lt;br&gt;
However, if you do want them to be unavailable until the user explicitly edits a record and just change TextBoxes to become readonly rather than disabled, so you can select text and scroll with multiline textboxes, then sub-class is a nice way to go.&lt;br&gt;
&lt;br&gt;
[quote]yes.. I see.. but subclassing I just don't call "easy way" to solve the problem . :)[/quote]&lt;br&gt;
&lt;br&gt;
Actually it is very easy.  Here the entire class:&lt;br&gt;
&lt;br&gt;
[codesnippet]&lt;br&gt;
using MicroFour.StrataFrame.UI.Windows.Forms;&lt;br&gt;
public class TextBox : Textbox, IBusinessBindable&lt;br&gt;
{&lt;br&gt;
&amp;nbsp;&amp;nbsp;public TextBox() { }&lt;br&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;// This replaces the BindingEditable property of the base class with out own.&lt;br&gt;
&amp;nbsp;&amp;nbsp;// This changes the ReadOnly property rather than the enabled property, which&lt;br&gt;
&amp;nbsp;&amp;nbsp;// allows for text to be selected and for scrolling.&lt;br&gt;
&amp;nbsp;&amp;nbsp;public new bool IBusinessBindable.BindingEditable&lt;br&gt;
&amp;nbsp;&amp;nbsp;{&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;get { return !this.ReadOnly; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;set { this.ReadOnly = !value; }&lt;br&gt;
&amp;nbsp;&amp;nbsp;}&lt;br&gt;
}[/codesnippet]&lt;br&gt;
&lt;br&gt;
I've attached a solution. This uses the StrataFrameSample db and shows how the standard SF Textbox behaves and how a readonly one would work. It also shows another way to go, handling the EditingStateChanged event of the BO and manually setting the readonly state (not what Trent was talking about...but I was confused for a bit :blink: ).&lt;br&gt;
&lt;br&gt;
I hope one of these ways gets you going!</description><pubDate>Thu, 28 Jan 2010 18:20:34 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: Change control disabled state to readonly</title><link>http://forum.strataframe.net/FindPost25644.aspx</link><description>Many of the standard Windows controls (from which the SF controls are inherited) do not have a ReadOnly property. This is one of the reasons that I use a lot of the Infragistics controls since I feel it is easier to read controls that are in ReadOnly state than controls that are disabled. I have my own version of the SF Infragistics wrapper that uses ReadOnly in place of Enabled for those controls that support it. I also modified the wrapper to set the default IgnoreManagedReadOnlyState to False instead of True so that it matches the default of the standard SF controls (not sure why they are different:Whistling: ) Since the SF wrapper seldom changes and I tend to use the most recent version of the Infragistics controls, having to maintain and re-comple the code is not a problem for me. It would be nice if the standard SF Infragistics wrapper worked this way but changing it now would probably cause problems for other SF users.</description><pubDate>Thu, 28 Jan 2010 13:38:19 GMT</pubDate><dc:creator>Larry Caylor</dc:creator></item><item><title>RE: Change control disabled state to readonly</title><link>http://forum.strataframe.net/FindPost25640.aspx</link><description>If you set the ManageUIReadonly state of the BO to false, the fields will never be automatically disabled based on the edit state.  I think that this is what you are looking for.  Also, you can do this on a per control basis also by setting the IgnoreUIReadonlyState property of an individual control to false.</description><pubDate>Thu, 28 Jan 2010 10:35:57 GMT</pubDate><dc:creator>Trent L. Taylor</dc:creator></item><item><title>RE: Change control disabled state to readonly</title><link>http://forum.strataframe.net/FindPost25634.aspx</link><description>:) yes.. I see.. but subclassing I just don't call "easy way" to solve the problem . :)</description><pubDate>Thu, 28 Jan 2010 04:20:19 GMT</pubDate><dc:creator>dgsoft</dc:creator></item><item><title>RE: Change control disabled state to readonly</title><link>http://forum.strataframe.net/FindPost25615.aspx</link><description>Try subclassing and overriding the BindingEditable property. Inside it, set the textboxes readonly state (instead of its enabled state).  I not feeling well today, but when I feel a bit better, I'll check my code....I think I've done this....</description><pubDate>Mon, 25 Jan 2010 10:06:56 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item></channel></rss>