LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retain display font format when appending a string

Solved!
Go to solution

I am trying to emulate an old DOS program with VGA monitor that does exactly what the original poster requested::  Append substrings to a displayed string without loosing the font color format.  The problem is as soon as you perform the concatenate, you loose the font color format!.   The DOS program and VGA dispaly has a host of font color and background color options on a character by character basis which is what I am having diffuclty replicating in LV.

 

I can accomplish this by either embedding a format stirng into my front panel display sting or maintain a "a 2-D color array" that indicates the offset into the diaplay string where the colors are to change.  In either case I get unsatisfactory results  because once a few differnet color substrings get into the Diaplay string, the display flicker that occurs while the sting color updates is annoying and it really boggs down the program. 

 

Anybody figure out how to do this easily in LV?  How about an  RTF activeX control that can be embedded as my VGA monitor emulator? Any ideas? 

 

Here is the VI that sets alternating line colors based on the 2-D color array where values indicate the last number of the last character of a strng of INPUT (ODD) and OUPUT(EVEN) colors,  works fine if you dont care about performanc, but not nearly as well as an old VGA monitor!  Gets much more complicated if you dont have alternating color substirngs, then you'd probably want use the srting search which quickly becomes extremely slow.

.

0 Kudos
Message 1 of 7
(2,759 Views)

Look at the comments on this (declined) idea in the Idea Excahnge for more information about why the string data does not contain formatting.

 

I think there may be some ideas there about RTF or HTML controls/indicators for strings. If you find ideas you like, give them kudos. The LV R&D team does look at those ideas and several have been implemented.

 

Lynn

0 Kudos
Message 2 of 7
(2,751 Views)

I am not asking NI to redeisgn or "polute" your definition of a string.  All I want to do, is something I could do in 1986 with IBM x286 PC, Quickbasic  and a VGA display?   Let me ask another way....

 

How to I display rich text or encoded font format from a LabVIEW program?  Of course changing font colors in a displayed string is no problem, I can do that all day long using the propery node for font.color!  The problem occurs when I try to append to the already displayed text without loosing the existing formatting?   You don't need to "polute" your sting definition, only make an "APPEND VALUE" propery node.  What;s in the string stays the same, new substring is simply appended,  Seems trivial?   Then there woudl be no need to extract the old string (which is where you loose the display formatting) concatenate the substring to it, put the new string back then apply the font formatting to the WHOLE thing!!!  

 

In the mean time I'd settle for an active X control. 

 

Why do I want this?  A little free VOC:  We have a bunch of older hodge-podge of production test equipment that we are trying to modernize with LabVIEW.  All of our "certified"  operator training, doucmentaion and work instructions are heavily based on screen shots of the existing test screens.  If I could duplicate those test sreeens, it would minimize the follow-on documentation operator retraining effort. 

 

Rick    

0 Kudos
Message 3 of 7
(2,733 Views)
Solution
Accepted by rickales1

This turns out to be a quite simple task using the .NET RichTextBox.  See attached.

0 Kudos
Message 4 of 7
(2,721 Views)

Here is another interesting option...

 

I used the font Perfect DOS VGA 437 to create an array of glyphs. Each glyph is itself a (8 x 16) array. Color each glyph with a foreground and background 4 bit index. Place the glyph in a (720 x 400) array, but gridded to (80 x 25), repeat for all 2000 locations. Use the array, along with a 16 color palette to draw a "4 bit" picture. I was unsure if this would be fast enough with all the array operations, but it is on my machine. See the attached demo.

 

The next level would be to implement 2 byte text buffers, where the first byte is the combined foreground and background 4 bit indexes and the second byte is the glyph index. These could be stored as flattened strings and appended without issue. Create some helpers to write the strings at particular locations. Maybe an X control for the picture control which accepts strings... Implement other VGA text mode features, like blinking, cursors...

 

The next level, retro text adventure using a huge LV state machine 😉

Download All
Message 5 of 7
(2,694 Views)

Why don't you use a plain table indicator. You can set background and font color for each cell. (make sure to defer FP updates while changing the colors).

 

Have a look at the simple example here for some ideas.. (not sure how fast it would be)

0 Kudos
Message 6 of 7
(2,674 Views)

@altenbach wrote:

... (not sure how fast it would be)


Nah..., it is still significatly slower than your version 😞

0 Kudos
Message 7 of 7
(2,661 Views)