LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Unicode in LabVIEW?

Solved!
Go to solution

Has anybody successfully created a Unicode control?

 

I mean without weird spaces in it.

 

If I catch the value change event, and update the string with the update VI, it works perfectly at first.

 

However, when LabVIEW is closed and reopened, the control seems to be corrupted. The character width isn't matching the typed characters. Clearing the string fixes it, but the moment I set a value in the control, or click in it a 2nd time, the corruption is back... This mean every time the user clicks in the control, I have to clear the value.

 

LabVIEW 2020... Both SP0 and SP1.

0 Kudos
Message 21 of 27
(1,449 Views)

wiebe@CARYA wrote:

Has anybody successfully created a Unicode control?

 

I mean without weird spaces in it.

 

If I catch the value change event, and update the string with the update VI, it works perfectly at first.

 

However, when LabVIEW is closed and reopened, the control seems to be corrupted. The character width isn't matching the typed characters. Clearing the string fixes it, but the moment I set a value in the control, or click in it a 2nd time, the corruption is back... This mean every time the user clicks in the control, I have to clear the value.

 

LabVIEW 2020... Both SP0 and SP1.


The behavior can seem bizarre if you don’t know exactly how a certain property works.  Specifically the “Interpret As Unicode” property of a text object.  It does not necessarily apply to the entire text.  It works like the font properties such as “italic”; it applies to the portion of the text specified by the “SelStart” and “SelEnd”.

"If you weren't supposed to push it, it wouldn't be a button."
Message 22 of 27
(1,445 Views)

@paul_cardinale wrote:

wiebe@CARYA wrote:

Has anybody successfully created a Unicode control?

 

I mean without weird spaces in it.

 

If I catch the value change event, and update the string with the update VI, it works perfectly at first.

 

However, when LabVIEW is closed and reopened, the control seems to be corrupted. The character width isn't matching the typed characters. Clearing the string fixes it, but the moment I set a value in the control, or click in it a 2nd time, the corruption is back... This mean every time the user clicks in the control, I have to clear the value.

 

LabVIEW 2020... Both SP0 and SP1.


The behavior can seem bizarre if you don’t know exactly how a certain property works.  Specifically the “Interpret As Unicode” property of a text object.  It does not necessarily apply to the entire text.  It works like the font properties such as “italic”; it applies to the portion of the text specified by the “SelStart” and “SelEnd”.


Yes, thanks. Your comment on interpret as unicode working like a font really helped. 

 

But that isn't an answer to the question.

 

In a control, when setting force unicode, I expect all entered data to be unicode. However, I get either text that is incorrect, or correct text and wrong cursor locations.

 

That's not bizarre, there's simply no way to make it work.

 

I simply want to allow the user to enter (and edit) a text that includes one or more unicode characters.

 

I can get it to work, at first. The user types an a, and the value change gives a 6100. Fine. In can add a 9403 programmatically, and I get a delta. Everything's fine. Until I restart LabVIEW. After that, there's no way to make it work again.

0 Kudos
Message 23 of 27
(1,441 Views)

wiebe@CARYA wrote:

@paul_cardinale wrote:

wiebe@CARYA wrote:

Has anybody successfully created a Unicode control?

 

I mean without weird spaces in it.

 

If I catch the value change event, and update the string with the update VI, it works perfectly at first.

 

However, when LabVIEW is closed and reopened, the control seems to be corrupted. The character width isn't matching the typed characters. Clearing the string fixes it, but the moment I set a value in the control, or click in it a 2nd time, the corruption is back... This mean every time the user clicks in the control, I have to clear the value.

 

LabVIEW 2020... Both SP0 and SP1.


The behavior can seem bizarre if you don’t know exactly how a certain property works.  Specifically the “Interpret As Unicode” property of a text object.  It does not necessarily apply to the entire text.  It works like the font properties such as “italic”; it applies to the portion of the text specified by the “SelStart” and “SelEnd”.


Yes, thanks. Your comment on interpret as unicode working like a font really helped. 

 

But that isn't an answer to the question.

 

In a control, when setting force unicode, I expect all entered data to be unicode. However, I get either text that is incorrect, or correct text and wrong cursor locations.

 

That's not bizarre, there's simply no way to make it work.

 

I simply want to allow the user to enter (and edit) a text that includes one or more unicode characters.

 

I can get it to work, at first. The user types an a, and the value change gives a 6100. Fine. In can add a 9403 programmatically, and I get a delta. Everything's fine. Until I restart LabVIEW. After that, there's no way to make it work again.


I think “Force Unicode” causes LV to assume that all data coming from the keyboard is Unicode.  But if it’s really ASCII, you get a mess.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 24 of 27
(1,426 Views)

The LabVIEW implementation of Unicode is scary, unreliable, and, under the right circumstances, it can affect even VIs that don't have it turned on.  And you cannot undo it.  It's been so long since I've thought about Unicode support that I can't remember the specifics.

 

I suppose that's why it never became an official feature.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 25 of 27
(1,413 Views)

@billko wrote:

The LabVIEW implementation of Unicode is scary, unreliable, and, under the right circumstances, it can affect even VIs that don't have it turned on.  And you cannot undo it.  It's been so long since I've thought about Unicode support that I can't remember the specifics.

 

I suppose that's why it never became an official feature.


I’m working on it.  See https://forums.ni.com/t5/LabVIEW/UI-Multi-language-with-Unicode/m-p/4113825#M1186408

"If you weren't supposed to push it, it wouldn't be a button."
Message 26 of 27
(1,394 Views)

wiebe@CARYA wrote:

Has anybody successfully created a Unicode control?


I think I have had a string control off screen which got the key focus and was then used to update a table or MCLB (because it was a tabular display that the user was updating). I'm fairly sure this had Unicode enabled and I probably tested it with Unicode characters (including through restarts), but I'm not sure the Unicode values I was threatened with where the system is deployed were ever actually inserted into the control, so I'm not 100% sure that this works.

 

Another option you could try is using a .NET text control, but that might be more of a pain in terms of visual appearance and handling all of the events, etc.


___________________
Try to take over the world!
0 Kudos
Message 27 of 27
(1,383 Views)