02-26-2021 09:25 AM
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.
02-26-2021 09:59 AM
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”.
02-26-2021 10:32 AM
@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.
02-26-2021 03:00 PM
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.
02-26-2021 10:05 PM
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.
02-28-2021 04:25 PM
@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
03-01-2021 01:05 AM
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.