I’m trying to create a ComboBox in code. The box appears but the text items
are not displayed in the box. The same steps work in PhAB. What am I
missing?
----- code snippet ------
PhDim_t type_cb_dim = { 75, 30 };
PhPoint_t type_cb_position = { 5, 20 };
char * type_cb_items [] = { “Item 1”, “Second Item”, “Penultimate”,
“Last”, 0 };
PtArg_t type_cb_args [] = { { Pt_ARG_POS,
(long)&type_cb_position, 0 },
{ Pt_ARG_DIM, (long)&type_cb_dim,
0 },
{ Pt_ARG_TEXT_STRING,
(long)&type_cb_items[0], 0 },
{ Pt_ARG_ITEMS, (long)type_cb_items,
0 } };
int num_type_cb_args = sizeof( type_cb_args ) / sizeof( PtArg_t );
PtWidget_t * type_cb = 0;
type_cb = PtCreateWidget( PtComboBox, my_window, num_type_cb_args,
type_cb_args );
“Bill Caroselli (Q-TPS)” <QTPS@earthlink.net> wrote:
: I’m trying to create a ComboBox in code. The box appears but the text items
: are not displayed in the box. The same steps work in PhAB. What am I
: missing?
: ----- code snippet ------
: PhDim_t type_cb_dim = { 75, 30 };
: PhPoint_t type_cb_position = { 5, 20 };
: char * type_cb_items [] = { “Item 1”, “Second Item”, “Penultimate”,
: “Last”, 0 };
: PtArg_t type_cb_args [] = { { Pt_ARG_POS,
: (long)&type_cb_position, 0 },
: { Pt_ARG_DIM, (long)&type_cb_dim,
: 0 },
: { Pt_ARG_TEXT_STRING,
: (long)&type_cb_items[0], 0 },
: { Pt_ARG_ITEMS, (long)type_cb_items,
: 0 } };
Shouldn’t you be specifying the number of entries in the array?
{ Pt_ARG_ITEMS, (long)type_cb_items, 4 } };
: int num_type_cb_args = sizeof( type_cb_args ) / sizeof( PtArg_t );
: PtWidget_t * type_cb = 0;
: type_cb = PtCreateWidget( PtComboBox, my_window, num_type_cb_args,
: type_cb_args );
\
Steve Reid stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems
Thanks Steve. Good catch. But that still doesn’t set the initially
selected text.
I have since added:
{ Pt_ARG_CBOX_SEL_ITEM, 1, 0 },
Still, when the Cbox is first rendered the “selected” item is blank.
“Steve Reid” <stever@qnx.com> wrote in message
news:airj8v$78n$1@nntp.qnx.com…
“Bill Caroselli (Q-TPS)” <> QTPS@earthlink.net> > wrote:
: I’m trying to create a ComboBox in code. The box appears but the text
items
: are not displayed in the box. The same steps work in PhAB. What am I
: missing?
: ----- code snippet ------
: PhDim_t type_cb_dim = { 75, 30 };
: PhPoint_t type_cb_position = { 5, 20 };
: char * type_cb_items [] = { “Item 1”, “Second Item”, “Penultimate”,
: “Last”, 0 };
: PtArg_t type_cb_args [] = { { Pt_ARG_POS,
: (long)&type_cb_position, 0 },
: { Pt_ARG_DIM,
(long)&type_cb_dim,
: 0 },
: { Pt_ARG_TEXT_STRING,
: (long)&type_cb_items[0], 0 },
: { Pt_ARG_ITEMS,
(long)type_cb_items,
: 0 } };
Shouldn’t you be specifying the number of entries in the array?
{ Pt_ARG_ITEMS, (long)type_cb_items, 4 } };
: int num_type_cb_args = sizeof( type_cb_args ) / sizeof(
PtArg_t );
: PtWidget_t * type_cb = 0;
: type_cb = PtCreateWidget( PtComboBox, my_window, num_type_cb_args,
: type_cb_args );
\
Steve Reid > stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems
Never mind. I got it.
I needed to take out the ‘&’ operator.
“Bill Caroselli (Q-TPS)” <QTPS@EarthLink.net> wrote in message
news:airk2t$2l8$1@inn.qnx.com…
Thanks Steve. Good catch. But that still doesn’t set the initially
selected text.
I have since added:
{ Pt_ARG_CBOX_SEL_ITEM, 1, 0 },
Still, when the Cbox is first rendered the “selected” item is blank.
“Steve Reid” <> stever@qnx.com> > wrote in message
news:airj8v$78n$> 1@nntp.qnx.com> …
“Bill Caroselli (Q-TPS)” <> QTPS@earthlink.net> > wrote:
: I’m trying to create a ComboBox in code. The box appears but the text
items
: are not displayed in the box. The same steps work in PhAB. What am I
: missing?
: ----- code snippet ------
: PhDim_t type_cb_dim = { 75, 30 };
: PhPoint_t type_cb_position = { 5, 20 };
: char * type_cb_items [] = { “Item 1”, “Second Item”,
“Penultimate”,
: “Last”, 0 };
: PtArg_t type_cb_args [] = { { Pt_ARG_POS,
: (long)&type_cb_position, 0 },
: { Pt_ARG_DIM,
(long)&type_cb_dim,
: 0 },
: { Pt_ARG_TEXT_STRING,
: (long)&type_cb_items[0], 0 },
: { Pt_ARG_ITEMS,
(long)type_cb_items,
: 0 } };
Shouldn’t you be specifying the number of entries in the array?
{ Pt_ARG_ITEMS, (long)type_cb_items, 4 } };
: int num_type_cb_args = sizeof( type_cb_args ) / sizeof(
PtArg_t );
: PtWidget_t * type_cb = 0;
: type_cb = PtCreateWidget( PtComboBox, my_window, num_type_cb_args,
: type_cb_args );
\
Steve Reid > stever@qnx.com
TechPubs (Technical Publications)
QNX Software Systems
New question.
On my ComboBox I have requested Pt_CB_SELECTION.
I found that I was receiving both Pt_LIST_SELECTION_FINAL &
Pt_LIST_SELECTION_BROWSE.
I don’t want to have to ignore the BROWSE callbacks.
Is there a flag I can set so that I will only receive the
Pt_LIST_SELECTION_FINAL?
I’m assuming that I need to turn Pt_ARG_SELECTION_MODE’s Pt_BROWSE_MODE’s
bit off. I’m about to try that.
I usually do my research by trying something in PhAB first and then writting
the code. But PhAB doesn’t seem to have a Pt_ARG_SELECTION_MODE resource
for a PtComboBox.
“Bill Caroselli (Q-TPS)” <QTPS@EarthLink.net> wrote in message
news:ais3ta$dp8$1@inn.qnx.com…
New question.
On my ComboBox I have requested Pt_CB_SELECTION.
I found that I was receiving both Pt_LIST_SELECTION_FINAL &
Pt_LIST_SELECTION_BROWSE.
I don’t want to have to ignore the BROWSE callbacks.
Is there a flag I can set so that I will only receive the
Pt_LIST_SELECTION_FINAL?
This did not work.
Any new suggestions about how to disable BROWSE callbacks?
“Bill Caroselli (Q-TPS)” <QTPS@EarthLink.net> wrote in message
news:ais4o3$e62$1@inn.qnx.com…
I’m assuming that I need to turn Pt_ARG_SELECTION_MODE’s Pt_BROWSE_MODE’s
bit off. I’m about to try that.
I usually do my research by trying something in PhAB first and then
writting
the code. But PhAB doesn’t seem to have a Pt_ARG_SELECTION_MODE resource
for a PtComboBox.
“Bill Caroselli (Q-TPS)” <> QTPS@EarthLink.net> > wrote in message
news:ais3ta$dp8$> 1@inn.qnx.com> …
New question.
On my ComboBox I have requested Pt_CB_SELECTION.
I found that I was receiving both Pt_LIST_SELECTION_FINAL &
Pt_LIST_SELECTION_BROWSE.
I don’t want to have to ignore the BROWSE callbacks.
Is there a flag I can set so that I will only receive the
Pt_LIST_SELECTION_FINAL?
\
Damn! I see that this is specifically disabled.
Why?!?!
“Bill Caroselli (Q-TPS)” <QTPS@EarthLink.net> wrote in message
news:ais4o3$e62$1@inn.qnx.com…
I’m assuming that I need to turn Pt_ARG_SELECTION_MODE’s Pt_BROWSE_MODE’s
bit off. I’m about to try that.
I usually do my research by trying something in PhAB first and then
writting
the code. But PhAB doesn’t seem to have a Pt_ARG_SELECTION_MODE resource
for a PtComboBox.
“Bill Caroselli (Q-TPS)” <QTPS@earthlink.net> wrote:
New question.
On my ComboBox I have requested Pt_CB_SELECTION.
I found that I was receiving both Pt_LIST_SELECTION_FINAL &
Pt_LIST_SELECTION_BROWSE.
I don’t want to have to ignore the BROWSE callbacks.
Is there a flag I can set so that I will only receive the
Pt_LIST_SELECTION_FINAL?
No. You can’t disable a subtype.
–
Wojtek Lerch QNX Software Systems Ltd.
“Bill Caroselli (Q-TPS)” <QTPS@earthlink.net> wrote:
I’m assuming that I need to turn Pt_ARG_SELECTION_MODE’s Pt_BROWSE_MODE’s
bit off. I’m about to try that.
Pt_BROWSE_MODE is not a bit. It’s just one of selection modes, and it’s
not really more related to the BROWSE callback subtype than any other
selection mode is to any other callback subtype.
I usually do my research by trying something in PhAB first and then writting
the code. But PhAB doesn’t seem to have a Pt_ARG_SELECTION_MODE resource
for a PtComboBox.
That’s because you can’t change it in PtComboBox. If you look at the
list of selection modes that list widgets support, you’ll see that most
of them wouldn’t make sense in a combo box.
Just add a line to your callback and ignore any subtype other than
FINAL. Or, depending on what exactly you’re trying to do, use the
TEXT_CHANGED callback instead.
–
Wojtek Lerch QNX Software Systems Ltd.