QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Special characters in a PhAB application |
Ref. No. |
QNX.000009851 |
Category(ies) |
Development |
Issue |
We want to label a button with a mathematical formula that includes one special character (the Greek uppercase sigma character)?
|
Solution |
You can generally access a lot of the special characters from within PhAB using the photon key compose sequences. If the character you want cannot be accessed via this method, you can generate a wider range of characters from code.
Here is a function that will help: void uni_strcat(char *str, wchar_t unicode){ x09char mb[MB_CUR_MAX + 1]; x09memset(mb, 0, MB_CUR_MAX + 1); x09wctomb(mb, unicode); x09strcat(str, mb); }
Give it a pointer to a string and the unicode value for the character you wish to append to the string.
Here is an example:
x09PtArg_t args[1]; x09char buf[64]; x09strcpy(buf, "y = "); x09uni_strcat(buf, 0x3a3); x09strcat(buf, "x, x = 0"); x09uni_strcat(buf, 0x2192); x09uni_strcat(buf, 0x221e); x09 x09PtSetArg(&args[0], Pt_ARG_TEXT_STRING, buf, 0); x09PtSetResources(label_wgt, 1, args);
Which places this mathematical expression into a label:
y = [sigma]x, x = 0 [to][infinity]
Now all you need are unicode values for your special characters(downoload a reference from the web or get a book from a computer bookstore).
|
|