# To subscribers of the xforms list from David Scriven <davidwriter@yahoo.com> :
I'm having a problem that I'm finding difficult to fix and would like
some advice.
The application consists of a main window which has a glcanvas
displaying an image and number of subwindows some of which contain a
glcanvas.
In particular one window with a glcanvas is created by the command
SubWnd->Show(x,y)
...
void Show(int x, y)
{
fl_set_form_position(Form(),xpos,ypos);
window=fl_show_form(Form(),FL_PLACE_GEOMETRY,FL_TRANSIENT,"Scale");
}
and hidden by
SubWnd->Hide()
....
void Hide()
{
if(fl_form_is_visible(Form()))fl_hide_form(Form());
}
When I access this section of code through the keyboard using a
canvas_handler to trap the keypress, I have no problem - the window
appears and disappears as it should any number of times. However, when
I use a menu to access the commands (apart from the access method, they
invoke identical commands), the subwindow is created OK, but system
crashes with the following when I try to hide the subwindow.
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 38 (X_QueryPointer)
Resource id in failed request: 0x0
I've tried using fl_winisvalid to check the window, but that always
returns true (one)
I went to the manual and rewrote the Show and Hide using the XMapWindow
& XUnMapWindow API's that are suggested for canvases:
....
Window window;
bool bCreate = true;
...
void Show(int xpos, int ypos)
{
if(bCreate)
{
fl_set_form_position(Form(),xpos,ypos);
window=fl_show_form(Form(),FL_PLACE_GEOMETRY,FL_TRANSIENT,"Scale");
bCreate = false;
}
else
XMapWindow(fl_get_display(), window);
}
void Hide()
{
XUnmapWindow(fl_get_display(), window);
}
This is a bit, but not much better - the first, 2nd or 3rd time you
hide the menu (it varies) you get
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 42 (X_SetInputFocus)
Serial number of failed request: 3276
I've checked for memory leaks and can find none - in any case
the code works indefinitely when the keyboard is pressed.
Perhaps you can see an obvious mistake that I've missed?
I'd be grateful for any advice as my knowledge of X-Windows
is quite limited.
DS
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://world.std.com/~xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/
Development: http://savannah.nongnu.org/files/?group=xforms
This archive was generated by hypermail 2b29 : Tue Jun 03 2003 - 15:32:24 EDT