Get Tree Item Info

Hi all,

I build a tree that attach the function callback

int
TreeSelection( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t
cbinfo )
{
/
eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

PtTreeCallback_t *Tree = ( PtTreeCallback_t *) cbinfo->cbdata;

///// Get Item Name
printf("String %s ",Tree->item->string);

return( Pt_CONTINUE );
}


When selecting the items in the Tree, how can I know
that the selecting item has no child ?

Thanks

Trong

Hello,

Sorry for the late response.
You can find out if there is a father, son, or brother. Using your code, I’ve added a test showing how you can access this information.

int
TreeSelection( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t cbinfo )
{
/
eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

PtTreeCallback_t *Tree = ( PtTreeCallback_t *) cbinfo->cbdata;

///// Get Item Name
printf("String %s ",Tree->item->string);

if ( Tree->item->gen.son)
{
printf( “There is a son\n”);
}
else
printf(“There is no son\n”);

return( Pt_CONTINUE );
}


Trong Truong Nguyen <tnguyen@aquilamsl.com> wrote:

Hi all,

I build a tree that attach the function callback

int
TreeSelection( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t
cbinfo )
{
/
eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;

PtTreeCallback_t *Tree = ( PtTreeCallback_t *) cbinfo->cbdata;

///// Get Item Name
printf("String %s ",Tree->item->string);

return( Pt_CONTINUE );
}



When selecting the items in the Tree, how can I know
that the selecting item has no child ?

Thanks

Trong