Jump to content

Text.ScrollPos


decyL

Recommended Posts

Hello. I'd like to use error (source,code,boolean) control as a GUI. I mean to use 'source' window to write test results to it. What I want to do is to create such VI that can write results line by line, and when the window is full to autoscroll the bar. I've tried to use property node for 'source' and text.scrollpos element, but it doesn;t work. :throwpc:

Link to comment
Hello. I'd like to use error (source,code,boolean) control as a GUI. I mean to use 'source' window to write test results to it. What I want to do is to create such VI that can write results line by line, and when the window is full to autoscroll the bar. I've tried to use property node for 'source' and text.scrollpos element, but it doesn;t work. :throwpc:

It works for me.

Download File:post-2800-1135038586.vi

Link to comment
Ok. So this is only for scrolling. Could you tell me how to make the cursor to write one line under another?

I've attached vi in which I tried to do this

You need to realize that each time your VI loops it replaces the text in the "Value" of the "source" so that at any time there is only the one number (using at most 2 ASCII characters) present. With only that one small bit of text in the text indicator, the text string is not long enough to wrap around enough to force the text box scrolling on and certainly not enough to cause there to be 29 or 30 lines of wrapped text as your example would seem to want

  • As you probably suspect now, scroll position is not the same as cursor position.
  • There is no cursor position control available to do what you want.
  • The scroll control will only work if there are enough lines in the display to enable scrolling and even then you can only scroll down as far as there are lines available. Depending on word wrap to get you the number of lines that you want is a bad idea - where and when the wraps occur depend on the text indicator size and the font size - a real house of cards. :thumbdown:
  • There are other characters you can insert into text strings that do break them into multiple lines such as your carriage return or line feed (a.k.a. new line) or the generic end-of-line character. Use one of them at the end of each line of text and build up an ever-increasing length of text and you'll end up with multiple lines and eventually the ability to set the scroll position

Note however that if your text indicator is tall enough to hold, for example say 3 lines of text without scrolling, that you will not get a scroll bar and be able to set a scroll position until you get four lines of text. And, in this case, when you do get 4 lines of text you will only be able to select either scroll position #1 or position #0. When you add a 5th line of text then you'll then get the additional option of scroll position #2, a 6th line of text will give an additional scroll position #3 and so forth. If someone comes along and resizes your text box vertically so that it'll hold more or fewer lines of text then all these numbers will change. (It's beginning to look like that "house of cards" again if a change to the size of a front-panel object causes a change in the way that the code behaves.)

If your only intent is to always have the last line of text showing then this won't matter; just wire a number equal to or greater than the number of lines in the display to the scroll position and the last line will always be displayed.

See example.

Download File:post-2800-1135094308.vi

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.