Click event don't be raised on a TextBox

P

Paulo Costa

Hi,
On a application for PocketPC2003 I need to use the event Click of a
TextBox.
Apparently Windows Forms Designer doesn't have the Click Event on the list
of events available on the Windows Forms Designer but you can generate it
from within the Code Editor (see below):

[constructor]...
{
....
textBoxTexto.Click +=new EventHandler(textBoxTexto_Click);
....
}
private void textBoxTexto_Click(object sender, EventArgs e)

{

index = textBoxTexto.SelectionStart;

}

But when I click with the device pointer in the textbox the Click event
isn't raised.

Can someone help me?

Thanks in advance

Paulo Costa
 
D

Daniel Moth

It is not supported. What are you trying to do? Maybe the Got/LostFocus
events or the Key events can help you...

Cheers
Daniel
 
P

Paulo Costa

Hi,

Thanks for your quick answer!

the Focus() sets SelectionStart=0 so I need to know the previous value so I
can reinitialize it:

private void textBoxTexto_GotFocus(object sender, System.EventArgs e)

{

textBoxTexto.SelectionStart=index;

}

so I need to have the index member with the correct value. I can't use
GotFocus because if the textbox has the Focus I can change the cursor
position (SelectionStart) with the device stylus (pen), without raising the
gotfocus event.

Maybe I can solve the problem reinitializing the index value in the
LostFocus!!!! I'm going to try!!´~

Thanks
Paulo Costa

Daniel Moth said:
It is not supported. What are you trying to do? Maybe the Got/LostFocus
events or the Key events can help you...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Paulo Costa said:
Hi,
On a application for PocketPC2003 I need to use the event Click of a
TextBox.
Apparently Windows Forms Designer doesn't have the Click Event on the list
of events available on the Windows Forms Designer but you can generate it
from within the Code Editor (see below):

[constructor]...
{
...
textBoxTexto.Click +=new EventHandler(textBoxTexto_Click);
...
}
private void textBoxTexto_Click(object sender, EventArgs e)

{

index = textBoxTexto.SelectionStart;

}

But when I click with the device pointer in the textbox the Click event
isn't raised.

Can someone help me?

Thanks in advance

Paulo Costa
 
G

Guest

I have the same problem with click event.
In my case, i need to select text in textbox when it is focused( with
Focus() method or when user clicks it)
I set SelectionStart and SelectionLength in GotFocus handler, but than
SelectionStart/Length is set by TextBox control to another value - propably
when handling Click event...


Daniel Moth said:
It is not supported. What are you trying to do? Maybe the Got/LostFocus
events or the Key events can help you...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Paulo Costa said:
Hi,
On a application for PocketPC2003 I need to use the event Click of a
TextBox.
Apparently Windows Forms Designer doesn't have the Click Event on the list
of events available on the Windows Forms Designer but you can generate it
from within the Code Editor (see below):

[constructor]...
{
...
textBoxTexto.Click +=new EventHandler(textBoxTexto_Click);
...
}
private void textBoxTexto_Click(object sender, EventArgs e)

{

index = textBoxTexto.SelectionStart;

}

But when I click with the device pointer in the textbox the Click event
isn't raised.

Can someone help me?

Thanks in advance

Paulo Costa
 
P

Paulo Costa

I forgot one thing: stylus (pen) doesn't raise Key events!! Or am I doing
something wrong??

Daniel Moth said:
It is not supported. What are you trying to do? Maybe the Got/LostFocus
events or the Key events can help you...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Paulo Costa said:
Hi,
On a application for PocketPC2003 I need to use the event Click of a
TextBox.
Apparently Windows Forms Designer doesn't have the Click Event on the list
of events available on the Windows Forms Designer but you can generate it
from within the Code Editor (see below):

[constructor]...
{
...
textBoxTexto.Click +=new EventHandler(textBoxTexto_Click);
...
}
private void textBoxTexto_Click(object sender, EventArgs e)

{

index = textBoxTexto.SelectionStart;

}

But when I click with the device pointer in the textbox the Click event
isn't raised.

Can someone help me?

Thanks in advance

Paulo Costa
 
D

Daniel Moth

Will doing it on a timer work for you?
http://groups-beta.google.com/group...tBox+Timer&qt_g=1&searchnow=Search+this+group

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Michal Rizek said:
I have the same problem with click event.
In my case, i need to select text in textbox when it is focused( with
Focus() method or when user clicks it)
I set SelectionStart and SelectionLength in GotFocus handler, but than
SelectionStart/Length is set by TextBox control to another value -
propably
when handling Click event...


Daniel Moth said:
It is not supported. What are you trying to do? Maybe the Got/LostFocus
events or the Key events can help you...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Paulo Costa said:
Hi,
On a application for PocketPC2003 I need to use the event Click of a
TextBox.
Apparently Windows Forms Designer doesn't have the Click Event on the
list
of events available on the Windows Forms Designer but you can generate
it
from within the Code Editor (see below):

[constructor]...
{
...
textBoxTexto.Click +=new EventHandler(textBoxTexto_Click);
...
}
private void textBoxTexto_Click(object sender, EventArgs e)

{

index = textBoxTexto.SelectionStart;

}

But when I click with the device pointer in the textbox the Click event
isn't raised.

Can someone help me?

Thanks in advance

Paulo Costa
 
D

Daniel Moth

Key events can be handled when the user uses the SIP to enter data.

If the Got/LostFocus approach doesn't help feel free to post back.

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Paulo Costa said:
I forgot one thing: stylus (pen) doesn't raise Key events!! Or am I doing
something wrong??

Daniel Moth said:
It is not supported. What are you trying to do? Maybe the Got/LostFocus
events or the Key events can help you...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Paulo Costa said:
Hi,
On a application for PocketPC2003 I need to use the event Click of a
TextBox.
Apparently Windows Forms Designer doesn't have the Click Event on the list
of events available on the Windows Forms Designer but you can generate it
from within the Code Editor (see below):

[constructor]...
{
...
textBoxTexto.Click +=new EventHandler(textBoxTexto_Click);
...
}
private void textBoxTexto_Click(object sender, EventArgs e)

{

index = textBoxTexto.SelectionStart;

}

But when I click with the device pointer in the textbox the Click event
isn't raised.

Can someone help me?

Thanks in advance

Paulo Costa
 
C

Chris Tacke, eMVP

The stylus produces mouse events, not key events.

--
<ctacke/>
www.OpenNETCF.org
Your CF searches start and end here


Paulo Costa said:
I forgot one thing: stylus (pen) doesn't raise Key events!! Or am I doing
something wrong??

Daniel Moth said:
It is not supported. What are you trying to do? Maybe the Got/LostFocus
events or the Key events can help you...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Paulo Costa said:
Hi,
On a application for PocketPC2003 I need to use the event Click of a
TextBox.
Apparently Windows Forms Designer doesn't have the Click Event on the list
of events available on the Windows Forms Designer but you can generate it
from within the Code Editor (see below):

[constructor]...
{
...
textBoxTexto.Click +=new EventHandler(textBoxTexto_Click);
...
}
private void textBoxTexto_Click(object sender, EventArgs e)

{

index = textBoxTexto.SelectionStart;

}

But when I click with the device pointer in the textbox the Click event
isn't raised.

Can someone help me?

Thanks in advance

Paulo Costa
 
G

Guest

I solved that with implementing IMessageFilter and handling WM_LBUTTONUP...

Daniel Moth said:
Will doing it on a timer work for you?
http://groups-beta.google.com/group...tBox+Timer&qt_g=1&searchnow=Search+this+group

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Michal Rizek said:
I have the same problem with click event.
In my case, i need to select text in textbox when it is focused( with
Focus() method or when user clicks it)
I set SelectionStart and SelectionLength in GotFocus handler, but than
SelectionStart/Length is set by TextBox control to another value -
propably
when handling Click event...


Daniel Moth said:
It is not supported. What are you trying to do? Maybe the Got/LostFocus
events or the Key events can help you...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Hi,
On a application for PocketPC2003 I need to use the event Click of a
TextBox.
Apparently Windows Forms Designer doesn't have the Click Event on the
list
of events available on the Windows Forms Designer but you can generate
it
from within the Code Editor (see below):

[constructor]...
{
...
textBoxTexto.Click +=new EventHandler(textBoxTexto_Click);
...
}
private void textBoxTexto_Click(object sender, EventArgs e)

{

index = textBoxTexto.SelectionStart;

}

But when I click with the device pointer in the textbox the Click event
isn't raised.

Can someone help me?

Thanks in advance

Paulo Costa
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top