ToolStrip Textbox Properties

Discussion in 'Questions (Windows Mobile)' started by RandomCoder, Jul 8, 2009.

  1. RandomCoder

    RandomCoder Well-Known Member Licensed 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
     
  2. agraham

    agraham Expert Licensed User

    See post #15 here http://www.basic4ppc.com/forum/addi...-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.
    Code:
    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
     
  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

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

    Thanks,
    RandomCoder
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice