ToolStrip Textbox Properties

RandomCoder

Well-Known Member
Licensed User
Longtime User
Hi all,

Is it possible to set the Textbox width for a ToolStrip Textbox?
I've tried using SetProperty from the door library but to no avail.

Also, is it possible to program an IgnoreKey?
I want only numeric keys, backspace and enter to be accepted.
I've attempted using the KeyChar property but the key that is pressed is not added to the TextBox until after exiting the KeyPress sub :confused:
As a work around I'm currently using the FocusLost event and checking that the value is numeric.

Thanks,
RandomCoder
 

agraham

Expert
Licensed User
Longtime User
Is it possible to set the Textbox width for a ToolStrip Textbox?
See post #15 here http://www.b4x.com/forum/additional...-controlsexdesktop-libraries-2.html#post18149

To ignore keys you could try this, I haven't tested it as I haven't got time at the moment. TbKeyPressEvent is a Door Event object and o is a Door Object.
B4X:
o.New1(false)
TbKeyPressEvent.New1(ToolStripTextBox1.ControlRef, "KeyPress") 
....

Sub TbKeyPressEvent_NewEvent
    o.Value =TbKeyPressEvent.Data 'Get the event's KeyPressEventArgs
    KeyChar = o.GetProperty("KeyChar ") 'Returns the character
    If .... whatever
        o.SetProperty("Handled", True) 'ignore the key
    End If
End Sub
 

RandomCoder

Well-Known Member
Licensed User
Longtime User
To ignore keys you could try this, I haven't tested it as I haven't got time at the moment.

Just confirming that this works as you thought it would :sign0162:

Thanks,
RandomCoder
 
Top