LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Coordinates of the data entered into a string control

Hi All,

 

I am in need of displaying the tip strip of the string control just below the position where I enter data.(Just like the text editor in MATLAB where on entering a function, the syntax is automatically displayed as tip strip/ dropdown box). It will be of great help even if I am able to find the coordinates of the data in the string, so that I will be able to display a tip strip/control at that specified coordinates.

 

Any insights or VIs for solving the issue are welcome. Thanks in advance.

 

 

Regards,

S.P.Prasaanth 

0 Kudos
Message 1 of 7
(3,694 Views)

Hi S.R.,

 

you cannot control the tip strip behaviour, you just set the text shown in the tip strip. And usually the tip strip is shown at the mouse coordinates.

 

But you could create your own VI (with a reduced front panel) to show your text, floating above your other front panel - and you will have full control over your own VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(3,668 Views)

As far as I know, you can't control the position of the tip-strip - I think it might be an OS feature.

 

What we have done in the past is to create our own borderless tip-strip VI and on mouseover, display the tip-strip VI with the appropriate text and hide it again on mouse leave.

 

Unfortunately I can't provide you with the full code, but this is basically the VI I created (and it's based on my colleague's old code, in case he ever sees this and says I'm taking all the credit):

2015-09-24_12-46-25.png

In my user interface VI, I send the 'show' and 'hide' events on mouse enter / mouse leave (and you can get clever about the timing to change how long until the tipstrip appears). The horizontal/vertical position is the bounds of the control plus a bit of a margin (available via control property node) and the text is the text I want to display on the tip-strip (which is variable).

 

The reason I use the caption rather than the value on the string control is that the caption can automatically resize to fit the text.

 


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 3 of 7
(3,665 Views)

Hi All,

 

Thanks for the posts. I will plan accordingly to use a VI for providing the tip strip. But I my case the tip should not be displayed while I hover the mouse. The actual scenario is that the user will be entering a function into a string control, as the user types the function the syntax of the function should be displayed as a tip strip(a VI). Any ways to achieve the functionality?

0 Kudos
Message 4 of 7
(3,647 Views)

The VI I posted a screenshot of allows you to display a tip-strip with a given string of your choice, it's up to you to decide when/how to show the tipstrip and with what text. You will need to register for the value change (with update value while typing on) event on your string control and find and display the appropriate text to display in the tip-strip.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 5 of 7
(3,642 Views)

Hi Sam,

 

The actual position where I want to display the tip strip is at the position where I am typing the data (Just like MATLAB and Visual Studio. i.e When you enter a function, a text containing the syntax for the function  gets displayed at the cursor position).

 

Any insights on how to determine the coordinates on where we enter the data so that I can pop the tip at that position

 

Regards,

S.P.Prasaanth

0 Kudos
Message 6 of 7
(3,635 Views)

You definitely have access to the following:

- Mouse position

- String control position/bounds

- You can get the cursor position (as an index) from the text.selection property

 

As for the screen coordinate of the cursor...this is going to be a bit of a hack unless you use a fixed-width font (in which case you can multiply the cursor position by the width and add to the control position), I think you would need to write your text to a picture control and then get the width of the resulting image and use that as your offset?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 7 of 7
(3,629 Views)