LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

can you disable the text box cursor?

Q#1. I have a READ ONLY text box set as an INDICATOR but I notice when I click inside the text box, a flashing cursor appears. If I previously tried to programmatically highlight a set of  text, using ATTR_TEXT_SELECTION_START and ATTRIB_TEXT_SELECTION_LENGTH, the highlighted text will disappear at the moment the cursor appears.  I want to maintain control of the highlighted text.....Anyway to do that?  I have one solution to refresh the highlighted text after the cursor placement via a timer....but don't really like that. The real solution is to prevent the cursor from being displayed.
 
 
Q#2. I constantly see people struggle with text boxes and have to convert them to list boxes because of not enough control over attributes.....Can you make a suggestion to the development team that they create a new text box control that gives them everything one would expect to be able to do with a text box??.....seems about time!
0 Kudos
Message 1 of 5
(3,776 Views)

I think you can prevent this behavior by "swallowing" the event in a control callback. Basically, for any event you want to ignore, you return with a non-zero value and CVI acts as if nothing was done to that control.

I'd suggest that at a minimum you will need to catch the EVENT_COMMIT and all of the mouse click and focus events to disable this behavior completely.

As for making suggestions about CVI, you can do that yourself, go to the contact page and then select product feedback.

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 2 of 5
(3,772 Views)
A little bit more detail on the cursor caret for indicators can be found in this thread. There you can find also the function for swallowing events according to Martin suggestion.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 5
(3,766 Views)

swallowing a EVENT_LEFT_ CLICK event, for example,  does indeed prevent the cursor from appearing in the text box!

Unfortunately, swallowing the left click makes it impossible to scroll the text box using the scroll tab (i.e, left click on scroll tab, grab and move) . Interesting that left clicking on the scroll arrows work though (one line at a time).

0 Kudos
Message 4 of 5
(3,761 Views)
Because the scrollbars have a fixed width, you can fairly easily determine whether the left click occurred on a scrollbar or not, using the width/height of the control and the click coordinates.  You can then swallow or propogate the event accordingly.

Mert A.
National Instruments
0 Kudos
Message 5 of 5
(3,755 Views)