[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
| 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 | 
792.0. "Program kills session manager" by 60464::LUK (Don't worry, be yuppie) Wed May 17 1989 03:15
/*
    Hi guys and gals,
    I wasn't sure where to report this 'bug' (feature ?), but I thought
    this may be the appropriate place.  When I run the following program,
    it kills the Session Manager - I can't understand why !!
    Could someone explain ??
    - Roger Luk
 *
 *   ASX stock ticker program.
 */
#include <stdio.h>
#include <decw$include/DwtAppl.h>
#define MAXARGS           16
static Widget	top_level, main_widget, work_area, exit_button, hold_button,
		restart_button, pop_window, ticker_window;
static Arg	arglist[MAXARGS];
/*
 *  Bitmaps.
 */
/*#include "asx.xbm"
Pixmap	asxlogo_pixm; */
XtCallbackProc exit_program();
/*
 *  Callbacks.
 */
static DwtCallback exit_callback[] = {
                      {exit_program, NULL},
                      {NULL, NULL}
                   };
/*
 *  Colours.
 */
Display	*dpy;
XColor	green_color, white_color, black_color;
main(argc,argv)
unsigned int argc;
char *argv[];
{
	int	n;
	Window	win;
	Screen	*scr;
	XColor	exact_color;
	/* Initialize the toolkit, and create the top-level widget */
	top_level = XtInitialize("ASX Ticker Control",
				"Example",NULL,0,&argc,argv);
	n = 0;
	XtSetArg(arglist[n],DwtNx,300); n++;
	XtSetArg(arglist[n],DwtNy,20); n++;
	XtSetArg(arglist[n],XtNallowShellResize,TRUE); n++;
	XtSetValues(top_level,arglist,n);
	/*
	 *  Initialize colours.
	 */
	dpy = DwtGetDisplay (top_level);
	win = DwtGetWindow (top_level);
	scr = XDefaultScreenOfDisplay(dpy);
	if (! XAllocNamedColor(dpy, DefaultColormapOfScreen(scr),
	    "white", &white_color, &exact_color))
		printf("Cannot allocate white !\n");
	if (! XAllocNamedColor(dpy, DefaultColormapOfScreen(scr),
	    "black", &black_color, &exact_color))
		printf("Cannot allocate black !\n");
	if (! XAllocNamedColor(dpy, DefaultColormapOfScreen(scr),
	    "green", &green_color, &exact_color))
		printf("Cannot allocate green !\n");
	create_windows();
	XtRealizeWidget(top_level);
	XtMainLoop();  /* Never returns */
	/* NOTREACHED */
}
create_windows()
{
	Window	w_win1;
	int	n,i;
	char	sbuf[12];
	/*
	 * Main
	 */
	main_widget = DwtMainWindow(top_level,"",300,10,600,300);
	XtManageChild(main_widget);
	/*
	 * Main work area
	 */
	work_area = DwtWindow(main_widget,"",0,0,600,300,NULL);
	XtSetArg(arglist[0],DwtNbackground,white_color.pixel);
	XtSetValues(work_area,arglist,1);
	XtManageChild(work_area);
	/*
	 * Push-buttons
	 */
	exit_button = DwtPushButton(work_area,
			"",5,50,DwtLatin1String("Exit"),exit_callback,NULL);
	XtManageChild(exit_button);
	/*
	 *  Popup dialog box and window for ticker.
	 */
	n = 0;
	XtSetArg(arglist[n],DwtNx,0); n++;
	XtSetArg(arglist[n],DwtNy,500); n++;
	XtSetArg(arglist[n],DwtNtitle,
			DwtLatin1String("ASX Share Prices")); n++;
	XtSetArg(arglist[n],DwtNstyle,DwtModeless); n++;
	XtSetArg(arglist[n],DwtNnoResize,FALSE); n++;
	XtSetArg(arglist[n],XtNallowShellResize,TRUE); n++;
	pop_window = DwtDialogBoxPopupCreate(work_area, "New win", arglist, n);
/*	XtAddEventHandler (pop_window,
			   StructureNotifyMask, FALSE,
			   resize_proc, NULL); */
	n = 0;
	XtSetArg(arglist[n],DwtNbackground,black_color.pixel); n++;
	XtSetArg(arglist[n],DwtNwidth,300); n++;
	XtSetArg(arglist[n],DwtNheight,100); n++;
/*	XtSetArg(arglist[n],DwtNexposeCallback,expose_win); n++; */
	ticker_window = DwtWindowCreate(pop_window,"",arglist,n);
	XtManageChild(ticker_window);
	XtManageChild(pop_window);
}
XtCallbackProc exit_program(w,tag,reason)
Widget w;
char *tag;
DwtAnyCallbackStruct *reason;
{
	exit(1);
}
| T.R | Title | User | Personal Name
 | Date | Lines | 
|---|
| 792.1 | System details | 60464::LUK | Don't worry, be yuppie | Wed May 17 1989 03:19 | 8 | 
|  | 
    Sorry, forgot this info:
    VAXstation 2000 4-plane
    VMS 5.1 SDC, DECW 5.1
    C compiler v3.0
 | 
| 792.2 | Work-around | LEOVAX::TREGGIARI |  | Wed May 17 1989 09:25 | 9 | 
|  |     The program kills the window manager on my system, not the session
    manager (window manager owns the icon box and the title bars...).
    
    I don't know why, but I do know a work-around.  Place the call
    to XtManageChild(pop_window) after the call to
    XtRealizeWidget(top_level).
    
    Leo
 | 
| 792.3 | ...and please enter a QAR on this... | VMSINT::PIPER | Derrell Piper - VAX/VMS Development | Wed May 17 1989 09:53 | 1 | 
|  | 
 | 
| 792.4 | Known bug | STAR::CYPRYCH |  | Wed May 17 1989 10:18 | 4 | 
|  |     Its a known bug - fix is forthcoming.
    
    
 | 
| 792.5 | And the work around is | STAR::CYPRYCH |  | Wed May 17 1989 10:19 | 5 | 
|  |     I should have also added - Leo's workaround will
    "work around" the problem in the interim. (see .2)
    
    
 | 
| 792.6 | Thanks | 60464::LUK | Don't worry, be yuppie | Wed May 17 1989 19:37 | 2 | 
|  |     Thanks for the prompt replies.
 |