Re: XForms: fileSelector ?

Steve Lamont (spl@szechuan.ucsd.edu)
Tue, 29 Sep 98 06:57:09 PDT

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

> I've got a problem with th fileSelector object :
>
> here is a piece of code :
>
> void positionXY_cb(FL_OBJECT *ob, long q)
> {
>
> Map * carte;
> char *buffer;
>
> carte=(Map *)ob->u_vdata;
>
> buffer=strdup(fl_show_fselector("extraction","./","*.xy",""));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is non-portable. On Suns, for example, this will produce a
program abort.

It would be better written:

buffer = fl_show_fselector( "extraction", "./", "*.xy", "" );
if ( buffer )
buffer = strdup( buffer );

I don't think this is the source of your problem, however.

> The problem appears when I try to use a Pixmap after having called
> positionXY_cb().
>
> This is the message I got :
>
> "X Error of failed request: BadDrawable (invalid Pixmap or Window
> parameter)
> Major opcode of failed request: 53 (X_CreatePixmap)
> Resource id in failed request: 0x700005d
> Serial number of failed request: 2977
> Current serial number in output stream: 3303"
>
> [...]
>
> another piece of code where i use the pixmap :
>
> _image=XCreatePixmap(dpy,_map->get_win(),_cadre.w,_cadre.h,8);

This is probably telling you that either the Drawable parameter is not
a valid Window or Pixmap or that the GC of the Drawable does not match
the depth of the Pixmap you are trying to create.

> does my problem come from the fl_winset() function ?

I don't think so. I'd guess that it's somehow involved with the
parameters of your XCreatePixmap() call. As I said above, it's
probably due to a mismatch between the depth of the Pixmap you're
trying to create and the depth of the Window returned by _map->get_win().

Since it's not clear what else is going on in your program,
particularly in the

carte->loadPositionXY(buffer);

function call, it's difficult to know what else to suggest.

Have you run the program in -sync mode? This may tell you more
accurately when and where your program encounters the error. Since X
generally runs in an asynchronous, buffered mode, errors are sometimes
reported significantly later than they actually occur, leading to
various puzzlements.

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/