I have a XmComboBox in a dialog.
It happens - sometimes - that the arrow is not
displayed at the outer right side of the combox.
It looks like the arrow attaches to the right of the
text. Unfortunately it looks very ugly because of
the grey area on the right of the arrow...
| TEXT | \/ |
Please, can somebody help?
regards,
Thomas
> Please, can somebody help?
Can you post a small piece of code which demonstrates your problem?
Then we can play with it and suggest a solution.
Dušan Peterc
http://www.arahne.si
arahne schrieb:
> Thomas Lehmann wrote:
>
> > Please, can somebody help?
>
> Can you post a small piece of code which demonstrates your problem?
> Then we can play with it and suggest a solution.
Took a little time but here is the code:
(two comboboxes, one above the other.
when selecting something at any combobox.
then the arrow buttons of the second will be translated)
CODE:
bool testingTwoComboboxes(Widget parent)
{
if (!parent)
return false;
struct MyCallBack
{
static void selected(Widget, XtPointer data,
XmComboBoxCallbackStruct*)
{
// adjusting content for first combo box.
XmStringTable tableB = (XmStringTable)XtMalloc(2 * sizeof
(XmString));
tableB[0] = XmStringCreateLocalized("SubValue A");
tableB[1] = XmStringCreateLocalized("SubValue B");
Widget widget = (Widget)data;
XtVaSetValues(widget, XmNitemCount , 2
, XmNitems , tableB
, XmNvisibleItemCount, 2
, XmNselectedItem , tableB[0]
, NULL);
// cleanup
XmStringFree(tableB[0]);
XmStringFree(tableB[1]);
XtFree((char*)tableB);
}//pushed
};
// defining initial properties of the widgets.
Arg arguments[10];
Cardinal count = 0;
const bool editable = false;
// switching concrete combobox type
const unsigned int type = (editable) ? XmDROP_DOWN_COMBO_BOX
: XmDROP_DOWN_LIST;
XtSetArg(arguments[count], XmNpositionMode ,
XmZERO_BASED);
++count; XtSetArg(arguments[count], XmNcomboBoxType , type);
++count;
// creating widgets
Widget form = XmCreateForm(parent, "form", 0, NULL);
Widget comboA = XmCreateComboBox(form, "comboA", arguments,
count);
Widget comboB = XmCreateComboBox(form, "comboB", arguments,
count);
// adjusting layout (one above the other)
XtVaSetValues(comboA, XmNleftAttachment , XmATTACH_FORM
, XmNrightAttachment , XmATTACH_FORM
, XmNtopAttachment , XmATTACH_FORM
, NULL);
XtVaSetValues(comboB, XmNleftAttachment , XmATTACH_FORM
, XmNrightAttachment , XmATTACH_FORM
, XmNtopAttachment , XmATTACH_WIDGET
, XmNtopWidget , comboA
, XmNbottomAttachment, XmATTACH_FORM
, NULL);
// adjusting content for first combo box.
XmStringTable tableA = (XmStringTable)XtMalloc(2 * sizeof
(XmString));
tableA[0] = XmStringCreateLocalized("Value A");
tableA[1] = XmStringCreateLocalized("Value B");
XtVaSetValues(comboA, XmNitemCount , 2
, XmNitems , tableA
, XmNvisibleItemCount, 2
, XmNselectedItem , tableA[0]
, NULL);
// cleanup
XmStringFree(tableA[0]);
XmStringFree(tableA[1]);
XtFree((char*)tableA);
XtAddCallback(comboA
,XmNselectionCallback
,(XtCallbackProc)MyCallBack::selected
,comboB);
// show
XtManageChild(form);
XtManageChild(comboA);
XtManageChild(comboB);
return true;
}//testingTwoComboboxes