473,395 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Caret Hiding

How do I hide the caret within a textbox and then show it again after the
text manipulation is completed?
May 22 '06 #1
4 2626
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?

May 22 '06 #2
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?

May 22 '06 #3
"Chris Rennie" <Ch*********@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/>

May 22 '06 #4
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


"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?

May 23 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Barry | last post by:
Retoring Caret Position after text field correction -------------------------------------------------------------------------------- Hi, my code has the following form - function...
3
by: Noah | last post by:
I have a text field in a form. I want the user to be able to click a DELETE button and have the character at the cursor position deleted. This would be just as if the user had pressed the Back...
7
by: Paul Gorodyansky | last post by:
Hi, Say I have a text in my TEXTAREA box - 01234567890 I want - using script - insert say "abc" in the middle. Works almost OK in Internet Explorer (with one problem) based on their example...
4
by: cc | last post by:
Hi, Is possible set and get the caret position of cursor in a text field ? Thanks, Carlo
6
by: kurotsuke | last post by:
Hi, I need to know the position (X, Y cohordinates) of the caret. I'm using the function: private static extern int GetCaretPos(ref POINT lpPoint); I'm actually getting a result but I...
2
by: randy | last post by:
Hi, I'm trying to set up a richtextbox to behave like the text area in a web browser, i.e. no caret, and a cursor that changes depending on what it's hovering over. I've been setting the...
6
by: Marc Robitaille | last post by:
Hello group, I need to remove the caret from the texbox. I tried with the HideCaret API and it doesn't work. Is there a way to hide it? if yes, Is it possible to show me how? Or if you have a...
1
by: Claire | last post by:
I'm writing an application with custom skinned controls. I have a text editor form with a rich edit control. Because there's no toolbuttons in the skinned control set, I have to use normal ones for...
0
Jezternz
by: Jezternz | last post by:
Okay, so a while back I managed to retrieve it correctly. In this thread: http://bytes.com/topic/javascript/answers/786211-retrieving-caret-start-end-values#post3127765 However I have found...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.