: /* add buttons and text widgets and stuff as above */
:
: return local_dialog;
:
: } /* end create_dialog() */
:
:
: Problem 1)
:
: I can't seem to get a handle on the graphics contexts of the dialog.
: I want to add a bit map and used Young p. 191 as an example. create_pixmap()
: and picmap_data are defined as he has it and this works fine at the main
: level.
:
: Things will compile fine, however when the call back is run I get:
:
: X Error of failed request: BadGC (invalid GC parameter)
: Major opcode of failed request: 56 (X_ChangeGC)
: Resource id in failed request: 0xf7800128
: Serial number of failed request: 465
: Current serial number in output stream: 515
:
:
: and the program crashes.
:
XtGetGC should only be used when you do not wish to change any of the GC values
in the GC. You specify all the values you care about and it finds or creates a
GC having the specified values. All other values are set to the default.
Once you have obtained the GC using XtGetGC, you should not try to change any
of it's values as this will potentially foul up other widgets.
XCreateBitmapFromData and XReadBitmapFile both work with a pixmap of depth 1 andany functions you perform on them should use a GC created with a drawable of
depth 1. The functions XCreatePixmapFromBitmapData and XCopyPlane should use a
GC with the desired depth(probably 8).
One common confussion you seem to have is that you must find THE GC for the
widget using XtGetGC. XtGetGC is an XtFunction which allows for the caching of
GC's so that if all widgets in your application have a background of red, and
a foreground of black, and all are on the same screen of the same display with
the same depth, that only one GC is used by all widgets instead of having each
widget create and use a seperate GC. You could create a new GC if you wish to