Project Home
Project Home
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Newbie - how to get index of a combo box?: (2 Items)
   
Newbie - how to get index of a combo box?  
With a combo box, I can set the index of item like this:

 PtSetResource( ABW_blablablaCombo, Pt_ARG_CBOX_SEL_ITEM, index, 0 );

Works like a charm.

But cannot get the selected index back ?!

  long *pn;
  PtGetResource( ABW_blablablaCombo, Pt_ARG_CBOX_SEL_ITEM, &pn, 0 );

This returns a pointer to some big value, which is not the index. No error.

Sorry for a stupid newbie question. 
If someone can point me to a better documentation or sample code for widgets, will be very grateful.

Perplexed...
- S.
Re: Newbie - how to get index of a combo box?  
Today I answer my own questions :)

Here is how to find the current index of a combo box:

uint16_t *p;
PtGetResource( ABW_combo, Pt_ARG_CBOX_SEL_ITEM, &p, 1 );

if ( !p || 0 == *p )
  printf("No selection!\n");
else
  printf("selected index=%d\n", *p -1 );

Hope it will be useful to others who look for this information. Because Google is huge, and life is short. And 
documentation is not sufficient without examples.

-- S.