StrataFrame Forum

Odd Textbox Behavior

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

By Bill Cunnien - 1/21/2008

The SF textbox control is exhibiting very odd behavior.  As soon as a user taps the space bar the cursor is sent to the beginning of the textbox.  The same behavior seems to be happening when the decimal point is used, too.

I am forced to replace all SF textboxes with DX textedit controls.  I hope this solves the problem.

Any idea what might have happened on those controls?

Bill

By Trent L. Taylor - 1/21/2008

Any idea what might have happened on those controls?

Do you have any Trim options set on the field properties?  This can cause this type of behavior when the field is evalutated.  You can get around this by either changing the property update to occur OnValidation instead of OnPropertyChanged...or create your own textbox and inherit the SF Textbox and add this code:


Private _PreviousText As String = String.Empty


''' <summary>
''' Overrides the OnTextChanged() method of the base class to prevent the firing
''' of the TextChanged event when a trimmed string is entered.
''' </summary>
''' <param name="e"></param>
''' <remarks></remarks>
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
    '-- If the previous saved text value is not equal to the new text value
    '   then allow the event to fire, otherwise, don't fire the event
    If Not Me._PreviousText.Trim().Equals(Me.Text.Trim()) Then
        MyBase.OnTextChanged(e)
    End If
    '-- Update the previous text
    Me._PreviousText = Me.Text
End Sub

By Bill Cunnien - 1/21/2008

That makes sense.  I do have some trim() stuff on some of those fields (not the numeric ones where the decimal point does the same thing).  I'll look into that a little more.  I wonder why the DevEx textedit control works and not the SF textbox.  Ahh, the mysteries of life.