XmList and wchar_t

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

2 posts / 0 new
Last post
XmList and wchar_t

Submitted by Anonymous (not verified) on Fri, 06/15/2012 - 12:07

Hi,
I'm listing chemical elements and i'm trying to put things like "226Ra" with "226" as superindex on my XmList.
Some of the superindexed numbers have high unicodes so you need wchar_t.
I've seen you can use wchar_t types on XmTextField with functions like XmTextFieldGetSelectionWcs(), etc.
I haven't found nothing similar in XmList, like XmAddItemUnselectedWcs() or something :)
Is there any way to do this, any function, unicode XmStrings?
Thanks,
Rodrigo
‹ UIL dumps core for unknown reason Making a widget invisible ›

guiqueen

Mon, 08/22/2005 - 20:50#1

Re: XmList and wchar_t

The following code creates list items with Unicode chars.

#include
#include
#include

char *months[] = {"??January", "??February", "??March", "?4April", "?5May",
"?6June", "?7July", "?8August", "??September", "??October",
"??November", "??December"};

String fallback[] = {
"*fontList: -*-*-medium-r-normal-*-14-*-*-*-*-*-*-*:",
NULL};

int
main (int argc, char* argv[])
{
Widget toplevel, list;
XtAppContext app;
int i, n = XtNumber(months);
XmStringTable str_list;
Arg args[4];

XtSetLanguageProc(NULL, NULL, NULL);
toplevel = XtVaOpenApplication(&app, "Demos", NULL, 0, &argc, argv,
fallback, sessionShellWidgetClass, NULL);

str_list = (XmStringTable) XtMalloc(n*sizeof(XmString));

for (i=0; i str_list[i] = XmStringCreateLocalized(months[i]);

i = 0;
XtSetArg(args[i], XmNlistSizePolicy, XmRESIZE_IF_POSSIBLE); i++;
XtSetArg(args[i], XmNvisibleItemCount, n); i++;
XtSetArg(args[i], XmNitemCount, n); i++;
XtSetArg(args[i], XmNitems, str_list); i++;
list = XmCreateScrolledList(toplevel, "hello", args, i);
XtManageChild(list);

for (i=0; i XmStringFree(str_list[i]);
XtFree((char*) str_list);

XtRealizeWidget(toplevel);
XtAppMainLoop(app);

return 0;
}