+ int width1, height1;
+ int width2, height2;
+
+ Widget listBox = (Widget) m_mainWidget;
+
+ GetSize(&width1, &height1);
+
+ bool managed = XtIsManaged(listBox);
+
+ if (managed)
+ XtUnmanageChild(listBox);
+
+ XmString *text = new XmString[nItems];
+ int i;
+ // Steve Hammes: Motif 1.1 compatibility
+// #if XmVersion > 1100
+// Corrected by Sergey Krasnov from Steve Hammes' code
+#if XmVersion > 1001
+ for (i = 0; i < nItems; i++)
+ text[i] = XmStringCreateSimple((char*) (const char*) items[i]);
+ XmListAddItemsUnselected(listBox, text, nItems, pos+1);
+#else
+ for (i = 0; i < nItems; i++)
+ {
+ text[i] = XmStringCreateSimple((char*) (const char*) items[i]);
+// XmListAddItemUnselected(listBox, text[i], i);
+ XmListAddItemUnselected(listBox, text[i], pos+i+1); // Another Sergey correction
+ }
+#endif
+ for (i = 0; i < nItems; i++)
+ XmStringFree(text[i]);
+
+ delete[] text;
+
+ // It seems that if the list is cleared, we must re-ask for
+ // selection policy!!
+ Arg args[3];
+ XtSetArg(args[0], XmNlistSizePolicy, XmCONSTANT);
+ if (m_windowStyle & wxLB_MULTIPLE)
+ XtSetArg(args[1], XmNselectionPolicy, XmMULTIPLE_SELECT);
+ else if (m_windowStyle & wxLB_EXTENDED)
+ XtSetArg(args[1], XmNselectionPolicy, XmEXTENDED_SELECT);
+ else XtSetArg(args[1], XmNselectionPolicy, XmBROWSE_SELECT);
+ XtSetValues(listBox,args,2) ;
+
+ if (managed)
+ XtManageChild(listBox);
+
+ GetSize(&width2, &height2);
+ // Correct for randomly resized listbox - bad boy, Motif!
+ if (width1 != width2 /*|| height1 != height2*/)
+ SetSize(-1, -1, width1, height1);