File Selection

Hi all,

I have 3 buttons, when one of them pressed → it will show
a panel (File Selection type).

I need that depends of the button, the “File Selection” will switch
to the different ROOT DIR like dir1 , dir2, dir3…

I use this function for switching, but the the witdget FileSelection
do not change the ROOT DIR required

PtSetArg( &Args[0], Pt_ARG_FS_ROOT_DIR, “/dir1”, 0 );
PtSetResources( ABW_FileSelection, 1, Args );

Do I miss some steps ?

Thanks for helping

Trong Nguyen

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

Hi all,

I have 3 buttons, when one of them pressed → it will show
a panel (File Selection type).

I need that depends of the button, the “File Selection” will switch
to the different ROOT DIR like dir1 , dir2, dir3…

I use this function for switching, but the the witdget FileSelection
do not change the ROOT DIR required

PtSetArg( &Args[0], Pt_ARG_FS_ROOT_DIR, “/dir1”, 0 );
PtSetResources( ABW_FileSelection, 1, Args );

Do I miss some steps ?

Thanks for helping

Trong Nguyen

Hi Trong,

The following example uses a button that when pressed highlights and
expands the “/home” directory. It walks through the list items and
compares the pathname to the directory you want to expand.

/******************************************************************* WALK() /
int
walk( PtFileSelItem_t root )
{
while( root ) {
if(!strcmp(root->fullpath, “/home”))
{
PtFSSelect(ABW_list, root);
PtFSGoto(ABW_list, root);
PtFSFolderExpand(ABW_list, root, NULL);
}
if( root->gen.son )
walk( (PtFileSelItem_t
)root->gen.son );
root = (PtFileSelItem_t
)root->gen.brother;
}
return 0;
}
/
************************************************************* PRINT_IT() ***/
int
print_it( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )
{
PtFileSelItem_t *item = PtFSRootItem( ABW_list );

printf( “root item = %p\n”, item );

walk( item );

return( Pt_CONTINUE );
}

Regards,
Barry