[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

1580.0. "Application without XtInitialize" by AVIATE::SHAH (LDP Technical Support Group) Mon Oct 16 1989 19:14


Hello all,

I have a question.  I have the following program (in the next reply) that uses
XtAppCreateShell, along with other appropriate routines.   I stay in a loop calling
these routines and destroying the creating widgets.  However the second time
around in the loop, I get an access violation on the DwtPushButtonGadgetCreate
routine.  Is there something I'm doing wrong?  Am I doing something illegal?  This 
is very important.

Also posted in DECWTOOLKIT notesfile...



Thanks in advance,
-Pratish Shah

T.RTitleUserPersonal
Name
DateLines
1580.1The program.....AVIATE::SHAHLDP Technical Support GroupMon Oct 16 1989 19:1694
#include <stdio.h>
#include <descrip.h>
#include <decw$include/DECwDwtApplProg.h>

static	void	ok_button_activate();
static	Widget	toplevel, dialogmain;
static	Widget	ok_button;
static	DwtCallback	callback_arg[2];
static	XtAppContext	app_context;

int	finished = FALSE;
Display	*display;
Arg	arglist[10];
static	int	number[]={0, 1, 2, 3, 4, 5};
static	int	FIRST = 1;

main()
{
	int i;

	for (i = 0; i<4; i++)
		pvmenu();
}

pvmenu()
{
	XrmOptionDescRec	options;
	int	temp;

	if (FIRST) {
		XtToolkitInitialize ();
		FIRST = FALSE;
			app_context = XtCreateApplicationContext();

	}
	display = XtOpenDisplay (app_context, NULL, "PVI",
				"pvclass", &options, 0, &number[0],
				0);  
	XtSetArg (arglist[0], XtNallowShellResize, TRUE);

	toplevel = XtAppCreateShell ("PVI", "pvclass",
		applicationShellWidgetClass, display, arglist, 1);

	XtSetArg (arglist[0], DwtNunits, DwtPixelUnits);
	dialogmain = DwtDialogBoxCreate (toplevel, "MAINWIN", arglist,
				    1);

	callback_arg[0].proc = ok_button_activate;
	callback_arg[0].tag = 0;
	callback_arg[1].proc = NULL;

	XtSetArg (arglist[0], DwtNx, 10);
	XtSetArg (arglist[1], DwtNy, 50);
	XtSetArg (arglist[2], DwtNactivateCallback, callback_arg);
	XtSetArg (arglist[3], DwtNlabel, DwtLatin1String ("OK"));
	XtSetArg (arglist[4], DwtNbordHighlight, TRUE);

	ok_button = DwtPushButtonGadgetCreate (dialogmain, "ok_button",
				    arglist, 
				    5);

	XtManageChild (ok_button);
	XtManageChild (dialogmain);
	XtRealizeWidget (toplevel);

	finished = FALSE;
	pvMainLoop();

	XtDestroyWidget (ok_button);
	XtDestroyWidget (dialogmain);
	XtDestroyWidget (toplevel);
	XtCloseDisplay (display);
/*	XtDestroyApplicationContext (app_context);*/
	XFlush(display);
}

pvMainLoop()
{
	XEvent	event;

	while (!finished) {
		XtAppNextEvent (app_context, &event);
		XtDispatchEvent (&event);
	}
}

static void	ok_button_activate (widget, tag, callback_data)
Widget	widget;
char	*tag;
DwtAnyCallbackStruct *callback_data;
{
	finished = TRUE;
}

1580.2A little researchSDSVAX::SWEENEYI was focused when focus wasnt coolMon Oct 16 1989 20:0215
    I cleaned the program up a bit and then got these errors
    
    X error event received from server: BadGC - parameter not a GC
      Failed request major op code 74 X_PolyText8
      Failed request minor op code 0 (if applicable)
      ResourceID 0x800005 in failed request (if applicable)
      Serial number of failed request 94
      Current serial number in output stream 95
    
    after about 5 cycles.
    
    By the way, someone will probably get around to reminding you that
    suspected bugs should be QAR'ed.  This really isn't a question of
    usage.