Home All Groups Group Topic Archive Search About
Author
22 May 2006 1:15 PM
Chris Rennie
How do I hide the caret within a textbox and then show it again after the
text manipulation is completed?

Author
22 May 2006 3:04 PM
M. Posseth
set the focus on another control and the blinking caret is away

after you are done set it back to the control


regards

Michel Posseth 



Show quoteHide quote
"Chris Rennie" wrote:

> How do I hide the caret within a textbox and then show it again after the
> text manipulation is completed?
Author
22 May 2006 3:23 PM
Chris Rennie
I found out that the correct way to do it is as follows:

    Public Declare Function HideCaret Lib "user32" Alias "HideCaret" (ByVal
hwnd As Integer) As Integer
    Public Declare Function ShowCaret Lib "user32" Alias "ShowCaret" (ByVal
hwnd As Integer) As Integer

Then it was just a matter of adding in:

Call HideCaret(myTextbox.handle.ToInt32)

Thanks for the response though.

Show quoteHide quote
"M. Posseth" wrote:

> set the focus on another control and the blinking caret is away
>
> after you are done set it back to the control
>
>
> regards
>
> Michel Posseth 
>
>
>
> "Chris Rennie" wrote:
>
> > How do I hide the caret within a textbox and then show it again after the
> > text manipulation is completed?
Author
22 May 2006 3:44 PM
Herfried K. Wagner [MVP]
"Chris Rennie" <ChrisRen***@discussions.microsoft.com> schrieb:
>I found out that the correct way to do it is as follows:
>
>    Public Declare Function HideCaret Lib "user32" Alias "HideCaret" (ByVal
> hwnd As Integer) As Integer
>    Public Declare Function ShowCaret Lib "user32" Alias "ShowCaret" (ByVal
> hwnd As Integer) As Integer

=>

\\\
Private Declare Function HideCaret Lib "user32.dll" ( _
    ByVal hwnd As IntPtr _
) As Boolean

Private Declare Function ShowCaret Lib "user32.dll" ( _
    ByVal hwnd As IntPtr _
) As Boolean
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
23 May 2006 12:34 PM
M. Posseth
Correct way ?   please define Correct

excuse me but removing the focus is in my opinion a much better way

In your implementation your code would break on a non MS system  ( ever
heard of MONO ??? or # develop ??? )

I personally only use API`s when there is absolutely no other way of doing
so through the framework and if i know for sure that my program wil only run
under a certain operating system  ( even Windows has changed and different
API  refernces between versions )

So correct could turn out to be incorrect :-)

using API for this is going from Amsterdam to Rome by first stopping in
Madrid while you were looking for the fastest way . 


Just my opinion

regards

Michel Posseth [MCP]
Michel Posseth 




Show quoteHide quote
"Chris Rennie" wrote:

> I found out that the correct way to do it is as follows:
>
>     Public Declare Function HideCaret Lib "user32" Alias "HideCaret" (ByVal
> hwnd As Integer) As Integer
>     Public Declare Function ShowCaret Lib "user32" Alias "ShowCaret" (ByVal
> hwnd As Integer) As Integer
>
> Then it was just a matter of adding in:
>
> Call HideCaret(myTextbox.handle.ToInt32)
>
> Thanks for the response though.
>
> "M. Posseth" wrote:
>
> > set the focus on another control and the blinking caret is away
> >
> > after you are done set it back to the control
> >
> >
> > regards
> >
> > Michel Posseth 
> >
> >
> >
> > "Chris Rennie" wrote:
> >
> > > How do I hide the caret within a textbox and then show it again after the
> > > text manipulation is completed?