Daki
Topic Author
Posts: 57
Joined: 16 Aug 2013, 00:48

Help with wide strings

02 Sep 2013, 03:57

Well, I feel kind of stupid asking this but I am having some trouble settings text programmatically on my Buttons and TextBlock objects. All my text uses 16 bit characters (it is Japanese). I'm a little lost looking through the string headers. I'm also a little confused because some of the documentation (namely Core.Kernel.Strings.html) references code that appears to be missing from the include directory of the SDK (I don't see String16).

How can I construct an NsString with 16 bit characters to give to SetText of a TextBlock?

How can I provide a 16 bit character string to a Button which does not have a SetText method, but a SetContent method instead?

I can do these things fine through the xaml, but I need to be able to do it in code as well.
 
User avatar
jsantos
Site Admin
Posts: 2904
Joined: 20 Jan 2012, 17:18
Contact:

Re: Help with wide strings

03 Sep 2013, 16:03

Well, I feel kind of stupid asking this but I am having some trouble settings text programmatically on my Buttons and TextBlock objects. All my text uses 16 bit characters (it is Japanese). I'm a little lost looking through the string headers. I'm also a little confused because some of the documentation (namely Core.Kernel.Strings.html) references code that appears to be missing from the include directory of the SDK (I don't see String16).
NoesisGUI is now UTF8 compliant in everything. This means that we use char (8 bits) for everything. It is decoded properly when needed. It is very important that XAML are saved used UTF8 convention.

For runtime, unicode strings from c# are marshaled to utf8 so I think that everything should work without doing anything special. Could you paste me a code in c# that is not working?
How can I construct an NsString with 16 bit characters to give to SetText of a TextBlock?
As said, normal strings in c# should work. If you have problems, there is a bug.
How can I provide a 16 bit character string to a Button which does not have a SetText method, but a SetContent method instead?

I can do these things fine through the xaml, but I need to be able to do it in code as well.
There is no SetText in the button because a button can contain anything. For your purpose you must use the SetContent(string) function. There is a version that accepts string as parameter.
 
Daki
Topic Author
Posts: 57
Joined: 16 Aug 2013, 00:48

Re: Help with wide strings

04 Sep 2013, 01:54

Thank you for the clarification. I didn't realize it was expecting UTF8, but upon converting my existing strings to this format they can be displayed with no problem. :)

Who is online

Users browsing this forum: Bing [Bot] and 2 guests