Click Event in TextBox2

Last post 04-16-2008 19:49 by ctacke. 7 replies.
Page 1 of 1 (8 items)
Sort Posts: Previous Next
  • 04-15-2008 7:17

    Click Event in TextBox2

    Hi, I'm trying to override the method OnClick for a custom control in a Smart Device Project. The Project compiles fine but there is not Click Event fired when i click in a Textbox. I guess this is because there is no click event in compact framework but I wonder why I can override a not existing method. Does anyone have an example how to implement a click event or/and a double click event for a custom control especially for a custom textbox. I'm using openNetcf Version 2.0.50727
  • 04-15-2008 9:41 In reply to

    Re: Click Event in TextBox2

     Why not just use the GotFocus event?

    N I C K
  • 04-15-2008 9:53 In reply to

    Re: Click Event in TextBox2

    GotFocus would be suitable just for the first step. I need the click event to override it with a base.onclick() .selectAll() so that it behaves more or less like a double click but with just one click. But then I want to override doubleClick to use the Double Click event to open a different Listbox on the form. with which the textbox interacts. Right at the moment I use a Functionalkey(F3) to open the Listbox but a doubleclick would be better because the user doesn't need to put his stylus away in order to use the keyboard. I know it's not the intension of Microsoft that a program behaves like this.
  • 04-16-2008 0:27 In reply to

    • qlqllu
    • Top 500 Contributor
    • Joined on 04-16-2008
    • Posts 1

    Re: Click Event in TextBox2

    i also want to know how to catch the click event of TextBox

  • 04-16-2008 9:28 In reply to

    Re: Click Event in TextBox2

    I think the OnMouse... methods are supported in the compact framework for textbox.  You can create your own Click event or method by using the mouse methods.  To implement double click build a timer component into the control.   If two mouse downs occur within an interval raise the double click event, if the interval expires with only one mouse down then raise the single click.

    N I C K
  • 04-16-2008 9:36 In reply to

    Re: Click Event in TextBox2

    Mouse Down isn't implemented either. That was my first guess.
  • 04-16-2008 18:43 In reply to

    Re: Click Event in TextBox2

     ah you are right.

     If you really want to do it you can take a look at this: VB or C#

    Find the section called "Subclassing to Intercept Win32 Messages".  Read up on how to create an umanaged dll that can intercept your textbox control's Win32 messages and pass those messages back to your compact framework application.
     

    N I C K
  • 04-16-2008 19:49 In reply to

    • ctacke
    • OpenNETCF Staff
    • Top 10 Contributor
    • Joined on 07-27-2007
    • Indiana
    • Posts 1,939

    Re: Click Event in TextBox2

    It's actually not that complex.  Just add an IMessageFilter implementation (from OpenNETCF.Windows.Forms - make sure your app is using Application2.Run) and catch the messages there.  No need for any native DLL. 

Page 1 of 1 (8 items)