Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!tcdcs!bofin!cjmchale From: cjmchale@cs.tcd.ie (Ciaran McHale) Newsgroups: comp.windows.x Subject: Re: X11R4: libXt GetResources(): Possible bug. Message-ID: <1991Feb8.230826.22326@cs.tcd.ie> Date: 8 Feb 91 23:08:26 GMT References: <1012@amix.commodore.com> Organization: DSG, Dept. of Comp. Sci., Trinity College, Dublin. Lines: 64 In <1012@amix.commodore.com> ag@amix.commodore.com (Keith Gabryelski) writes: >*--------------------------------------* > static Boolean Warnings; > > static XtResource resources[] = > { > { > "warnings", "Warnings", XtRBoolean, sizeof(Boolean), > (Cardinal) &Warnings, XtRImmediate, (caddr_t)0, > }, > }; > > main() > { > XtGetApplicationResources(Shell, NULL, resources, XtNumber(resources), > NULL, 0); > } >*--------------------------------------* > >[Keith recognises that the above code is bugged and asks for a fix] You should have "Warnings" as a member of a structure, rather than a global variable. The second parameter to XtGetApplicationResources() should be a pointer to this structure and in your resources[] array you specify the offset of "Warnings" within the structure. Here's example code to show you what I mean. ----start code---- struct resources_dest_type { unsigned long sea_colour, land_colour; ... /* other resources */ }; resources_dest_type resources_dest; #define offset(member) XtOffsetOf(resources_dest, member) static XtResource resources[] = { {"sea", "Sea", XtRPixel, sizeof(Pixel), offset(sea_colour), XtRString, "SkyBlue"}, {"land", "Land", XtRPixel, sizeof(Pixel), offset(land_colour), XtRString, "MediumAquamarine"}, ... /* other resources */ }; main() { ... XtGetApplicationResources(a_widget, &resources_dest, resources, XtNumber(resources), NULL, 0); ... } ----end code---- I hope that's of some help. Ciaran. -- Ciaran McHale "Verbosity says it all" ____ Department of Computer Science, Trinity College, Dublin 2, Ireland. \ / Telephone: +353-1-772941 ext 1538 FAX: +353-1-772204 \/ Telex: 93782 TCD EI email: cjmchale@cs.tcd.ie