LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Does anyone have a read only text file viewer LabVIEW VI with search and highlight capability?

Hello,

I have to create a VI to display a text file in such a way that the user
cannot modify any text. However they should be able to search and see
the result highlighted.

Unfortunately I cannot use standard products like Notepad / Wordpad since
there is no way to stop the text on the screen from being modified.

I have begun my own viewer VI but it is turning out to be much more
complicated than I thought and I don't want to re-invent the wheel.

Anyone know of anything that already exists?

Thanks,

Ronnie
TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 1 of 6
(3,361 Views)
I hope the attached file helps. It is a simple vi that you should be able to modify to your own needs.
0 Kudos
Message 2 of 6
(3,343 Views)
Thanks Dan,

This is pretty similar to what I have already, so it's good to know
I'm on the right track.
This example (like mine) doesn't scroll when the highlighted
search string is out of view but I'll do the math myself to
work out the line number.
Again, many thanks,
Ronnie
TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 3 of 6
(3,333 Views)
Dan,

I wanted to further add to my previous email that in actual fact your VI
was very helpful in assisting me track down why my VI would not perform
the highlight on selected text. It seems that it makes a difference whether
or not the string is a control or indicator. On mine it was an indicator
and even though I was setting focus to the string as part of the string property,
the text would only show as highlighted when I physically clicked with the
mouse anywhere in the indicator. However on yours it is highlighted immediately
when the seacrh button is used - the difference being that the text is in a control.
I don't understand why this is taking place but I say this for the benfit of
any other users who are having trouble with Text.StartSel etc.

So thanks again,

Ronnie
TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 4 of 6
(3,324 Views)
Since you need to use a control, you may need an easy way to prevent edits to it. If so, create an event structure with the Key Down? event and wire the Discard input to a TRUE constant. You may have to get a bit more creative/selective about which key strokes are/are not discarded, but that is the general idea.
0 Kudos
Message 5 of 6
(3,301 Views)
Thank you for the advice. And so here is the resultant text only viewer
with search and auto scroll for anyone in the future that needs such a thing.
The scroll to the find string isn't great but it works reasonably.
TestStand 4.2.1, LabVIEW 2009, LabWindows/CVI 2009
0 Kudos
Message 6 of 6
(3,280 Views)