LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

display style for string control

Hi All,

I'm having a problem with writing the contents of a string control to
a file.

What I have is a setup screen with 2 multi-line string controls (among
other things) that I want to write to an ascii file on exit. I'm
trying to force any multiline contents of those two boxes to a single
line in the file. To do this I created a property node for the string
control, changed the display style to 'show '\' codes' then write the
string. This works, with 1 caveat. While the user is in the setup I
want to display the strings without the codes, so I don't change the
display property until 'OK to exit' is clicked. When I add this
feature the strings are never output with the '\' codes.

Basically I have a state machine. On init of this
vi I set defaults
for the controls and set the two string controls to normal display.
On the exit state I change the display to '\' codes then write the
contents to file. If I don't include the show normal property on the
init, the codes are written successfully, but they are also displayed
on the screen. If I include the show normal code in the init state,
the codes are not written to file.

Am I missing a refresh property or an updatedata-like function to
assure the string control is correcting its contents to the proper
format before I write it to file?

Any help appreciated.

Greg Cole
gcc9@cdc.gov
0 Kudos
Message 1 of 3
(3,203 Views)
Without your VI, it's difficult to understand your problem but I think you're making things a little too difficult. To eliminate multi-lines from the file you write, I would just do a search and replace of the line feed constant before doing the file write. The file palette has this function as well as the line feed constant that you need wire to the search string input. The replace string defaults to a null string or or can specify something else - like a space. The replace all input is by default false so you should wire a true constant there. By doing the search and replace, you can then leave your string controls in normal display mode at all times.
0 Kudos
Message 2 of 3
(3,203 Views)
Changing the display style of a string control doesn't affect the data at
all, it just changes the way the control displays the string. The "Show
Codes" display style does just that, it SHOWS the codes in the display. It
does NOT change the contents of the string. You should just do a search for
new line characters and replace them with spaces, then do the save.

Kelly Bersch
Anadigm, Inc
www.Anadigm.com

"Greg Cole" wrote

Hi All,

I'm having a problem with writing the contents of a string control to
a file.

What I have is a setup screen with 2 multi-line string controls (among
other things) that I want to write to an ascii file on exit. I'm
trying to force any multiline contents of those two boxes to a single
line in the file. To do this I
created a property node for the string
control, changed the display style to 'show '\' codes' then write the
string. This works, with 1 caveat. While the user is in the setup I
want to display the strings without the codes, so I don't change the
display property until 'OK to exit' is clicked. When I add this
feature the strings are never output with the '\' codes.

Basically I have a state machine. On init of this vi I set defaults
for the controls and set the two string controls to normal display.
On the exit state I change the display to '\' codes then write the
contents to file. If I don't include the show normal property on the
init, the codes are written successfully, but they are also displayed
on the screen. If I include the show normal code in the init state,
the codes are not written to file.

Am I missing a refresh property or an updatedata-like function to
assure the string control is correcting its contents to the proper
format before I write it to file?

Any help ap
preciated.

Greg Cole
gcc9@cdc.gov
Message 3 of 3
(3,203 Views)