LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

horizontal scroll of single line string

I have a string control that can have a lot of data in it, but it is constrained to be one single line.  I would like to eliminate the usual horizontal scrollbar and place buttons at the two ends of the string to control moving around in the string.  In my playing around with this, I have not found a way to move the string left or right to get the active part into view programatically.  The vertical scrollbar on a string with multiple lines I can simulate, but not the horizontal one going left or right on a single line string.  What have I missed?
Bart
0 Kudos
Message 1 of 17
(5,430 Views)
I tried the "Text.ScrollPos" and that seems to work to move the text horizontally for a string indicator that is tall enough to show just one line, and constrained by "Limit to Single Line".  I guess I would have to turn around and say what have I missed?
0 Kudos
Message 2 of 17
(5,422 Views)

Hi,

Indeed the Text.ScollPos is the property want to use.  I would also suggest using the EnableWrap property to limit how the text is displayed.  If you are wondering what the LimitSglLine property is used for, there is a good forum here that others discuss it. 

http://forums.ni.com/ni/board/message?board.id=170&message.id=17569&requireLogin=False

I hope that helps.

Brian K.
0 Kudos
Message 3 of 17
(5,396 Views)
Hi All:
So now I am really confused.  Two people say the text.scrollpos is the thing to use, and I had already tried without success before I asked.  I have revisited my test, and it still does not work.  Is there something i could have done to the control (it is a string control I want to get working) that would clobber this?  I have a visible horizontal scrollbar (for my test) that I would like to remove after I get an alternativie working.  For the test, I have a string of about 120 characters in a window about 75 characters wide.  I wired the output of a numeric slide control to the test.scrollpos input, and nothing happens.  If I read the test.scrollpos output with another property node in the same while loop, I never see the value change from 0, and my line of text remains motionless.  I have played with selection position also without success.  If you move around by the mouse, the position in the string moves and the string scrolls as needed to keep the selection position visible.  If I move the selection position around programmatically, the selection position moves, but can go off the visible portion of the string, all without ever changing the values reported by text.scrollpos.  The only way I have succeeded in getting test.scrollpos to do anything useful is when I have reoriented my string to be vertical with a "word" per line, then the scrolling works to move from line to line, including changing the value of text.scrollpos.  My panel layout strongly prefers the horizontal string, so that is what I am trying to fix.
Bart
0 Kudos
Message 4 of 17
(5,376 Views)

Based on my understanding of what you want, a single line of text with a horizontal scrollbar and no word wrapping, Text.Scroll Position will not work because the property deals with lines. 

In the help file for this property.

Scroll Position Property

Property of Text.

Position of the scroll box in the scroll bar. To set the position, wire a numeric value to this property that represents the line number to which you want to scroll. The position is 0-indexed. For example, if a string control contains 6 lines of text, you can wire a value of 2 to this property to move the scroll box to the position of the third line.

I have yet to find a property that truly deals with horizontal position.

Message 5 of 17
(5,366 Views)


@bjlv wrote:
I have a string control that can have a lot of data in it, but it is constrained to be one single line.  I would like to eliminate the usual horizontal scrollbar and place buttons at the two ends of the string to control moving around in the string.  In my playing around with this, I have not found a way to move the string left or right to get the active part into view programatically.  The vertical scrollbar on a string with multiple lines I can simulate, but not the horizontal one going left or right on a single line string.  What have I missed?
Bart


Bart,

What you ve missed is that a Str control doesnt ve a horizontal scrollbar to bring into view the desitred portion of the string.

Unlike the other 2 replies, using the TextScrollposition property also wont serve the purpose as Ravens Fan has indicated.

Maybe you can use the String Subset function coupled with a horizontal slide for the user to scroll it.

Try out the attached VI & modify it as per your requirement.

- Partha ( CLD until Oct 2027 🙂 )
Message 6 of 17
(5,335 Views)
Exhibit A.

Also, to whomever handed out single stars to the replies: before handing out single stars, why don't you try to code it up first and then determine if it meets the user's needs?
Message 7 of 17
(5,321 Views)
Hi smercurio:
I finally figured out what it was I had overlooked.  Your example (which matches my requirements beautifully) is in LV8.2.  I am working in 8.0.1, although I have 8.2 available.  You can not do in 8.0.1 what works so easily in 8.2.  I may have to do an LV upgrade to this project afterall, although early releases of the project are in the field, as executables only, in version 8.0.1.  At least I understand now why I thought this was tough and you thought it was easy.
Bart

0 Kudos
Message 8 of 17
(5,271 Views)

Bart,

I don't understand what you mean by not being able to do in 8.0.1 what is easily done in 8.2.  This VI, once saved for version 8.0, has the same functionality.

Brian Coalson

Software Engineer
National Instruments
0 Kudos
Message 9 of 17
(5,247 Views)
Hi Coal Man:
What I mean is that I have access to 8.2 on other computers, but near the end of a big project that is so far only at 8.01, I am not going to upgrade for this one thing.  When you start out in 8.0.1, you can not make this text.scrollpos work for horizontal scrolling, only for vertical scrolling.  I suppose I could make a copy of the control (to preserve the management approved front panel appearance of a product very close to its launch date), move it to an 8.2 computer, build the property so it works, do a downgrade save, and then reimport the control back to 8.01, all to get something that should have worked in the first place.  I don't even know if that will work after the round trip from 8.0.1 to 8.2 and back.  Will it still work after the project is built as an executable?  If I have enough time, I suppose I will find out.
Bart
0 Kudos
Message 10 of 17
(5,238 Views)