[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

836.0. "composite widget inside file_selection widget" by 6240::FARMER () Wed May 24 1989 10:57

	I'm  trying  to  use  a  composite  widget in the one subwidget
	allowed in a file_selection widget.  If I use  a  single  radio
	box,  it  works.   But  if  I put that into a dialog box (where
	there'll  be  more  subwidgets  eventually),  it  doesn't  work
	(errors below).  any ideas?  thx/cliff

object
    comp_box : file_selection {
	arguments {
	    default_position = true;
	    dir_mask = '*.NET';
	    style = DwtModeless;
	    title = 'Compile Network';
	    };
 	controls {
  	    dialog_box comp_box2;
	    };
	callbacks {
	    activate = procedure comp_proc (0);
	    cancel   = procedure comp_proc (0);
	    create = procedure create_proc (k_comp_box);
	    };
	};

object 
    comp_box2 : dialog_box {
	controls {
	    radio_box str_beh_box;
	    };
	callbacks {
	    create = procedure create_proc (k_comp_box);
	    };
	};

object
    str_beh_box : radio_box {
	controls {
	    toggle_button structural_compile;
	    toggle_button behavioral_compile;
	    };
	callbacks {
	    create = procedure create_proc (k_str_beh_box);
	    };
	};


on FetchWidget (...'comp_box'...):
X error event received from server: BadWindow - parameter not a Window
  Failed request major op code 1 X_CreateWindow
X error event received from server: BadWindow - parameter not a Window
  Failed request major op code 33 X_GrabKey
X error event received from server: BadWindow - parameter not a Window
  Failed request major op code 2 X_ChangeWindowAttributes
X error event received from server: BadWindow - parameter not a Window
  Failed request major op code 2 X_ChangeWindowAttributes
X error event received from server: BadWindow - parameter not a Window
  Failed request major op code 1 X_CreateWindow
X error event received from server: BadWindow - parameter not a Window
  Failed request major op code 9 X_MapSubwindows
X error event received from server: BadWindow - parameter not a Window
  Failed request major op code 9 X_MapSubwindows

T.RTitleUserPersonal
Name
DateLines
836.1RTL::BOLGATZWed May 24 1989 18:43310
    the following is a test driver (non-UIL) that creates 2 fs widgets.
    fs #1 contains a work-area dialog box which in turns contains a 
    pushbutton.  It works fine.  Since I do not know UIL very well, perhaps
    you could try to break this test driver?
    
    Let me know...
    
    Jay
    
    
#ifdef VMS
#include "decw$include:decwdwtwidgetprog.h"
#include <descrip.h>
#include <rmsdef>
#else
#include "/usr/include/X11/DECwDwtWidgetProg.h"
#endif

#include "Vendor.h"

/* Command line options table.  Only resources are entered here...there is a
   pass over the remaining options after XtParseCommand is let loose. */

static XrmOptionDescRec options[] = {
{"-label",	XtNlabel,	XrmoptionSepArg,	NULL}
};


/*
 * Report the syntax for calling xlabel
 */
Syntax(call)
	char *call;
{
}

static FileSelectionWidget fileselect, fs2;

static Widget toplevel, create_fs_pb, exit_fs_pb, setval_pb, work, mainw;
static Widget shell,create_fs_pb2, setval_pb2, unmanage_pb, workbutton;
static Widget subwork;

static void bye_bye()
{

    exit(1); 

}

static DwtCallback bye_bye_cb[2] = 
{
    {(VoidProc) bye_bye, NULL},
    {NULL, NULL}
};


static void manage()
{
    XtManageChild(fileselect);
};

static DwtCallback manage_cb[2] = 
{
    {(VoidProc) manage, NULL},
    {NULL, NULL}
};

static void manage2()
{
    XtManageChild(fs2);
};

static DwtCallback manage_cb2[2] = 
{
    {(VoidProc) manage2, NULL},
    {NULL, NULL}
};


static void getval(w,tag,reason)
Widget w;
int *tag;
unsigned long *reason;
{
    Arg    arglist[1];
    DwtCompString value;

    XtSetArg(arglist[0], DwtNvalue, &value);
    XtGetValues(fileselect, arglist, 1);

};

static DwtCallback getval_cb[2] = 
{
    {(VoidProc) getval, NULL},
    {NULL, NULL}
};


static void unmanage(w,tag,reason)
Widget w;
int *tag;
unsigned long *reason;
{
    XtUnmanageChild(w);
    getval(w,tag,reason);
};

static DwtCallback unmanage_cb[2] = 
{
    {(VoidProc) unmanage, NULL},
    {NULL, NULL}
};

static void setval2(w,tag,reason)
Widget w;
int *tag;
unsigned long *reason;
{
    Arg    arglist[1];

    XtSetArg(arglist[0], DwtNvalue, DwtLatin1String("a value"));
    XtSetValues(fs2, arglist, 1);
};

static DwtCallback getval_cb2[2] = 
{
    {(VoidProc) setval2, NULL},
    {NULL, NULL}
};

static void cvttoext(fs,oldmask,newmask)
FileSelectionWidget fs;
DwtCompString oldmask;
DwtCompString *newmask;
{
    *newmask = DwtLatin1String("ext format");
};

static void cvttoint(fs,oldmask,newmask)
FileSelectionWidget fs;
DwtCompString oldmask;
DwtCompString *newmask;
{
    *newmask = DwtLatin1String("*.c");
};

static void cvtfiletoext(fs,oldfile,filec,newfile)
FileSelectionWidget fs;
DwtCompString oldfile;
int filec;
DwtCompString **newfile;
{
    int i;

    *newfile = (char **) XtMalloc(sizeof(char *) * filec);

    for (i=0;
	 (i<filec);
	 i++)

	(*newfile)[i] = DwtLatin1String("ext file format");
};

static void cvtfiletoint(fs,oldfile,filec,newfile)
FileSelectionWidget fs;
DwtCompString oldfile;
int filec;
DwtCompString **newfile;
{
    int i;

    *newfile = (char **) XtMalloc(sizeof(char *) * filec);

    for (i=0;
	 (i<filec);
	 i++)

	(*newfile)[i] = DwtLatin1String("int file format");
};

int main()
{
    Arg    arglist[20];
    int    argCount = 0;
    char   *dirmask, *value;
    int *dpy, argc=0;
    char *argv[4];
    struct dsc$descriptor_s  	temp$dsc;

    {
	char c[6];
	int i;

	sscanf("1234$","%d",&i);
	sprintf(c,"%d",12345);
    }

    toplevel = XtInitialize("name", "class",
			     options, 1, 
			     &argc, &argv);

    DwtSetArg("FALSE",arglist,0,XtNiconState);
    DwtSetArg("TRUE",arglist,1,XtNnoResize);
    DwtSetArg("TRUE",arglist,2,XtNnoLower);
    DwtSetArg("TRUE",arglist,3,XtNnoIconify);
    XtSetValues(toplevel,arglist,4);

    mainw = DwtMainWindow(toplevel,"main",0,0,300,300);
    XtManageChild(mainw);    

    work = DwtDialogBoxCreate(mainw,"work",NULL,0);
    XtManageChild(work);    

    create_fs_pb = DwtPushButton(work,
			       "create fs pb",
			       20,20,
			       DwtLatin1String("manage fs widget"),
			       manage_cb,NULL);
    XtManageChild(create_fs_pb);
    
    unmanage_pb = DwtPushButton(work,
			       "create fs pb",
			       20,40,
			       DwtLatin1String("unmanage fs widget"),
			       unmanage_cb,NULL);
    XtManageChild(unmanage_pb);
    
    create_fs_pb2 = DwtPushButton(work,
			       "create fs pb",
			       20,60,
			       DwtLatin1String("manage fs #2 widget"),
			       manage_cb2,NULL);
    XtManageChild(create_fs_pb2);
    
    setval_pb = DwtPushButton(work,
			       "exit fs pb",
			       20,80,
			       DwtLatin1String("SetValues"),
			       getval_cb,NULL);
    XtManageChild(setval_pb);
    
    setval_pb2 = DwtPushButton(work,
			       "exit fs pb",
			       20,100,
			       DwtLatin1String("SetValues on fs #2"),
			       getval_cb2,NULL);
    XtManageChild(setval_pb2);
    
    exit_fs_pb = DwtPushButton(work,
			       "exit fs pb",
			       20,120,
			       DwtLatin1String("exit"),
			       bye_bye_cb,NULL);
    XtManageChild(exit_fs_pb);
    
    argCount = 0;     
    XtSetArg(arglist[argCount], DwtNstyle, DwtModeless);
    argCount++;
    XtSetArg(arglist[argCount], DwtNdefaultPosition, TRUE);
    argCount++;       
    XtSetArg(arglist[argCount], DwtNactivateCallback, unmanage_cb);
    argCount++;       
    XtSetArg(arglist[argCount], DwtNcancelCallback, unmanage_cb);
    argCount++;       
    XtSetArg(arglist[argCount], DwtNdirMask, DwtLatin1String("*.c"));
    argCount++;                              

    fileselect = DwtFileSelectionCreate(mainw,
			       		"test file select",
					arglist, 
					argCount);

    subwork = DwtDialogBoxCreate(fileselect,"work",NULL,0);
    XtManageChild(subwork);    

    workbutton = DwtPushButton(subwork,
			       "fileselection pushbutton",
			       0,0,
			       DwtLatin1String("FS button"),
			       NULL,NULL);
    XtManageChild(workbutton);

    temp$dsc.dsc$a_pointer 	= "test select";
    temp$dsc.dsc$w_length 	= strlen("test select");
    temp$dsc.dsc$b_dtype	= DSC$K_DTYPE_T;
    temp$dsc.dsc$b_class 	= DSC$K_CLASS_S;

    fs2 = DWT$SELECTION(&mainw,
		        &temp$dsc,
			&0,&0,
		        DwtLatin1String("title"),
			NULL,
		        NULL,
			&0,
			&5,
			&DwtModeless,
			&TRUE,
			NULL, NULL);

    DwtMainSetAreas (mainw, NULL, work, 0, 0, 0);

    XtRealizeWidget(toplevel);

    XtMainLoop();

    /* UNREACHABLE */
    return (0);
}