Re: XForms: fl_load_browser problem.

Steve Lamont (spl@szechuan.ucsd.edu)
Mon, 17 Aug 98 17:29:00 PDT

# To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :

> How come fl_load_browser (obj, "/navtech/nav/data/scenario/METAR50");
> <-- and actual file
>
> works okay.. but doing this
>
> char path_and_filename [ 1024], filename [1024];
>
> strcpy (filename, fl_get_browser_line (browser, line_number));
> sprintf (path_and_filename, "/navtech/nav/data/%s", filename);
> fl_load_browser (obj, path_and_filename);
>
>
> doesn't work?

Dunno. Works for me. Here's a little callback I wrote to test the
problem.

void browser_cb( FL_OBJECT *ob, long data )

{

int line = fl_get_browser( ob );
char buffer[MAXPATHLEN];
char fullpath[MAXPATHLEN];

strcpy( buffer, fl_get_browser_line( ob, line ) );
sprintf( fullpath, "/home/spl/tmp/try/%s", buffer );

fl_load_browser( ob, fullpath );

}

void browser_cb( FL_OBJECT *ob, long data )

{

int line = fl_get_browser( ob );
char fullpath[MAXPATHLEN];

sprintf( fullpath, "/home/spl/tmp/try/%s",
fl_get_browser_line( ob, line ) );

fl_load_browser( ob, fullpath );

}

Works fine, too.

The browser is a FL_SELECT_BROWSER. I'm assuming that the browser
used for file selection is the same browser used to display the file
contents.

Are you perhance using any attribute characters at the beginning of
the line when you load the filenames into the browser? If so, then
you need to strip them off before you call sprintf() to create the
pathname.

spl
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/