retriving data from PtLIST

Hi All,
I am using PtList in one of my project, To add items I am using
PtListAddItems() like this:

int First = 10;
char Second[20] = “Second”;
int Third = 30;
char *line[10];
char my_line[100];

callback
{
sprintf(my_line, “%d, %s %d”, First,Second,Third);
line[0] = my_line;
PtListAddItems(widget, (const char**)line, 1,1);
}

With this code I am able to add Items to the list, and by using
PT_ARG_SELECTION_INDEXES I am getting Indexes of list item, Now I want to
get selected items by using the index number.

Urgent please!
Looking forward with this mail,
Regards,
Suresh Kumar. Kavula.

Suresh Kumar wrote:

Hi All,
I am using PtList in one of my project, To add items I am using
PtListAddItems() like this:

int First = 10;
char Second[20] = “Second”;
int Third = 30;
char *line[10];
char my_line[100];

callback
{
sprintf(my_line, “%d, %s %d”, First,Second,Third);
line[0] = my_line;
PtListAddItems(widget, (const char**)line, 1,1);
}

With this code I am able to add Items to the list, and by using
PT_ARG_SELECTION_INDEXES I am getting Indexes of list item, Now I want to
get selected items by using the index number.

Urgent please!
Looking forward with this mail,
Regards,
Suresh Kumar. Kavula.

I use the below:

unsigned short gphoton_ptlist_get_single_sel_index (PtWidget_t * widget)
{
unsigned short * index = NULL;
PtGetResource(widget,Pt_ARG_SELECTION_INDEXES,&index,0);
return * index;
}

char * gphoton_ptlist_get_single_sel (PtWidget_t * widget)
{
char ** items;
unsigned short * len;
unsigned short selected;

selected = gphoton_ptlist_get_single_sel_index(widget);
PtGetResource(widget,Pt_ARG_ITEMS, &items,&len);
return items[ selected - 1];
}

HTH

Garry

Thank you very much Mr. Garry,
It’s working fine.

With Best Regards,
Suresh Kumar. Kavula

“Garry” <asdf34sdg@sdfasdf3.com> wrote in message
news:ceret4$8hm$1@inn.qnx.com

Suresh Kumar wrote:
Hi All,
I am using PtList in one of my project, To add items I am using
PtListAddItems() like this:

int First = 10;
char Second[20] = “Second”;
int Third = 30;
char *line[10];
char my_line[100];

callback
{
sprintf(my_line, “%d, %s %d”, First,Second,Third);
line[0] = my_line;
PtListAddItems(widget, (const char**)line, 1,1);
}

With this code I am able to add Items to the list, and by using
PT_ARG_SELECTION_INDEXES I am getting Indexes of list item, Now I want
to
get selected items by using the index number.

Urgent please!
Looking forward with this mail,
Regards,
Suresh Kumar. Kavula.


I use the below:

unsigned short gphoton_ptlist_get_single_sel_index (PtWidget_t * widget)
{
unsigned short * index = NULL;
PtGetResource(widget,Pt_ARG_SELECTION_INDEXES,&index,0);
return * index;
}

char * gphoton_ptlist_get_single_sel (PtWidget_t * widget)
{
char ** items;
unsigned short * len;
unsigned short selected;

selected = gphoton_ptlist_get_single_sel_index(widget);
PtGetResource(widget,Pt_ARG_ITEMS, &items,&len);
return items[ selected - 1];
}

HTH

Garry