StrataFrame Forum

Disabling Strataframe-Textboxes

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

By Thomas Holste - 9/10/2010

Hi there,

I don't know if I understand the behaviour of the enabled-property of the strataframe-textbox.

I am trying to disable a textbox (which I understand as that a control can not receive focus and thus can not be edited), which is not bound to a BO-field. When I set the enabled-property to false, the field can still be edited (changed).

When I bind a textbox to a BO it is, as described in the help-file, editable when I change the BO to edit-state.

But when I change the enabled-property for such a field to false to prevent it from being modified when a BO gets in edit-state, it still receives focus and can be changed.

So by now I can't see what the enabled-property really does?

I know I could set the read-only property to true but this does not prevent that a textbox gets focus and I can not change the background-color.

Thanks in Advance

Thomas
By Ivan George Borges - 9/11/2010

Hi Thomas.

Use your BO EditingStateChanged event to deal with that.

Private Sub MyBO1_EditingStateChanged( _
    ByVal e As MicroFour.StrataFrame.Business.EditingStateChangedEventArgs) _
    Handles MyBO1.EditingStateChanged
   
    If e.EditingState = MicroFour.StrataFrame.Business.BusinessEditingState.Editing Then
        Me.MyControl.Enabled = False
    End If

End Sub
By Thomas Holste - 9/13/2010

Hi Ivan,

thanks for your help, I will try this. But what about the non-databound-use of the enabled-property of the textbox? Does this not work by design and should I use some other control for this?

Best regards

Thomas
By Ivan George Borges - 9/13/2010

Sorry, Thomas... you did say it was an unbound control, I missed that one.

In this case, just set the control's IgnoreManageReadOnlyState to True.

By Thomas Holste - 9/13/2010

Hi Ivan,

sorry if I did confuse you but I was trying both ways unbound and bound.

Now, thanks to your help everything is working fine.

Best regards

Thomas
By Ivan George Borges - 9/13/2010

Glad I could help, Thomas. Wink