[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

3131.0. "How use XtOpenDisplay with VT1000 " by TRNOI1::POLETTI () Wed Jul 25 1990 08:48





	A customer want to open many display on severals VT1000 from a 
        single VMS ,detached process.

	He wants to use XtOpenDisplay using the node name in a similar
        method when it open a display on decnet node :

  	XtOpenDisplay ( ... , "NODE::0.0" , ... );

	Is there some sintax expression to directly address the VT1000 or
        this sintax will be available with futures releases of DECwindows ?

        Actually customer uses the follow method to solve the problem.

        $ set disp/create/node=lat_xxxxxxxxxxxx/tran=lat dis_pro_1
        $ set disp/create/node=lat_xxxxxxxxxxxx/tran=lat dis_pro_2
        $ ass /sys 'f$trnlnm("dis_pro_1")' dis_sys_1
        $ ass /sys 'f$trnlnm("dis_pro_2")' dis_sys_2

	and then use

  	XtOpenDisplay ( ... , "dis_sys_1" , ... );
  	XtOpenDisplay ( ... , "dis_sys_2" , ... );

	it this way a correct method or there are some simpler way
  	to solve the problem?

	Follow an example to test the prototype of the customer,
		
					Thanks in advance
					Sergio Poletti @TNO


*********************************************************************************


$ logdev = f$process()
$ run /detach/proc=hello_phigs/out='logdev' hello_phigs


*****************************************************************************



/* Include files */
#include <stdio.h>
#include <string.h>
#include <math.h>

#ifdef VMS 
#include <decw$include/DECwDwtApplProg.h>
#include <decw$include/Xlib.h>
#include <file.h>
#endif

#ifdef ultrix
#include <X11/DECwDwtApplProg.h>
#include <X11/Xlib.h>
#include <sys/file.h>
#include <limits.h>
#endif

#define screenNumber	DefaultScreen(dpy)
#define rootWindow      RootWindow(dpy,screenNumber)
#define blackPixel	BlackPixel(dpy,screenNumber)
#define whitePixel	WhitePixel(dpy,screenNumber)


static DRMHierarchy	s_DRMHierarchy;		/* DRM database hierarch id */
static char		*vec[]={"hello_phigs.uid"};
						/* DRM database file list   */
static DRMCode		class ;

static void helloworld_button_activate();

static DRMCount		regnum = 1 ;
static DRMRegisterArg	regvec[] = {
	{"helloworld_button_activate",(caddr_t)helloworld_button_activate}
	};

/*
 *  Main program
 */
int main(argc, argv)
    unsigned int argc;
    char **argv;
{
    /*
     *  Declare the variables to contain the two widget ids
     */
    Widget toplevel, helloworldmain;
    XtAppContext main_cont;
    Arg arglist[1] ;
    Display *dpy;
    Window window;

    /*
     *  Initialize the DRM
     */

    DwtInitializeDRM ();

    /*
     *  Initialize the toolkit.  This call returns the id of the "toplevel"
     *  widget.  The applications "main" widget must be the only child
     *  of this widget.
     */

    toplevel = XtInitialize(
	"Hi",	 			/* application name */
	"helloworldclass",              /* application class */
	NULL, 0,                        /* options */
	&argc, argv);                   /* command line parameters */

    XtSetArg (arglist[0], XtNallowShellResize, TRUE) ;
    XtSetValues (toplevel, arglist, 1) ;

    /*
     *  Define the DRM hierarchy (only 1 file)
     */

    if (DwtOpenHierarchy (1,			    /* number of files	    */
			vec, 			    /* files     	    */
			NULL,			    /* os_ext_list (null)   */
			&s_DRMHierarchy)	    /* ptr to returned id   */
			!= DRMSuccess) {
	printf ("can't open hierarchy");
     }

    /*
     * 	Register our callback routines so that the resource manager can 
     * 	resolve them at widget-creation time.
     */

    DwtRegisterDRMNames (regvec, regnum) ;

    /*
     *  Call DRM to fetch and create the pushbutton and its container
     */
    if (DwtFetchWidget (s_DRMHierarchy,
			"helloworld_main",
			toplevel,
			&helloworldmain,
			&class)
			!= DRMSuccess)
			    printf("can't fetch interface");

    /*
     *  Make the toplevel widget "manage" the main window (or whatever the
     *  the uil defines as the topmost widget).  This will
     *  cause it to be "realized" when the toplevel widget is "realized"
     */
    XtManageChild(helloworldmain);
    
    /*
     *  Realize the toplevel widget.  This will cause the entire "managed"
     *  widget hierarchy to be displayed
     */
    XtRealizeWidget(toplevel);

    main_cont = XtWidgetToApplicationContext (toplevel);
    if ((dpy = XtOpenDisplay (main_cont, "dis_sys_1","prova",
          "prova",NULL,0,&argc,argv)) != NULL) {

        window=XCreateSimpleWindow (dpy,rootWindow,100,100,200,200,
                                    blackPixel,whitePixel);
        XMapWindow (dpy,window);
    }

    /*
     *  Loop and process events
     */

    XtMainLoop();
}

static void helloworld_button_activate( widget, tag, callback_data )
	Widget	widget;
	char    *tag;
	DwtAnyCallbackStruct *callback_data;
{
            exit();
}


********************************************************************************




module hello_phigs
    version = 'v1.0'
    names = case_sensitive

procedure
    helloworld_button_activate();

object
    helloworld_main : dialog_box {
	controls {
	    label	helloworld_label;
	    push_button	helloworld_button;
	};
    };

object
    helloworld_button : push_button {
	arguments { 
	    x = 15;
	    y = 40;
	    label_label = 'Hello\nPhigs!';
	};
	callbacks { 
	    activate = procedure helloworld_button_activate();
	};
    };

object
    helloworld_label : label {
	arguments {
	    label_label =
		'Press button once\nto change label\ntwice to exit.';
	};
    };

end module;


T.RTitleUserPersonal
Name
DateLines
3131.1Simpler methodSTAR::VATNEPeter Vatne, VMS DevelopmentWed Jul 25 1990 12:419
The customer should be able to use the logical name from SET DISPLAY directly:

        $ set disp/create/node=lat_xxxxxxxxxxxx/tran=lat dis_pro_1
        $ set disp/create/node=lat_xxxxxxxxxxxx/tran=lat dis_pro_2

	and then:

  	XtOpenDisplay ( ... , "dis_pro_1" , ... );
  	XtOpenDisplay ( ... , "dis_pro_2" , ... );
3131.2A detached process can't use the display create with DCLTRNOI2::POLETTIThu Jul 26 1990 04:0011
    
    
    	It is not possible to use directly dis_pro_1 because the process
        that use XtOpenDisplay is a detached process and can't see
    	dis_pro_1 in the process table and also what real the customer
        wants is to avoid the display definition by DCL and use the
        VT1000 lat address directly in XtOpenDisplay,
    
      						Regards.
    		
    						Sergio Poletti @TNO
3131.3SET DISPLAY is the only methodSTAR::VATNEPeter Vatne, VMS DevelopmentThu Jul 26 1990 14:3415
>    	It is not possible to use directly dis_pro_1 because the process
>        that use XtOpenDisplay is a detached process and can't see
>    	dis_pro_1 in the process table and also what real the customer
>        wants is to avoid the display definition by DCL and use the
>        VT1000 lat address directly in XtOpenDisplay,

Okay, I see now.  I didn't look at the example very closely.

Well, the answer is that there are no plans to extend the syntax
accepted by OpenDisplay to allow the specification of node and transport.
This was the main reason that SET DISPLAY was invented in the first place.

The fact that the logical name created by SET DISPLAY can't be seen by
the detached process whereas the WSA device can, sounds like an oversight
to me.  I will QAR it.
3131.4Do 'SET DISPLAY' by hand in the codeVINO::MCARLETONReality; what a concept!Fri Jul 27 1990 15:4011
    I'm looking into solving a similar problem by creating a new WSA device
    from inside my code.  I plan to clone a new WSA with SYS$ASSIGN and
    fill in the node and transport with SETMODE QIO calls.  I can then pass
    the new WSA device name to XtOpenDisplay.  This has the effect of doing
    a SET DISPLAY from inside my code.  I believe that this method should
    be rolled up into a DwtCreatePseudoDisplay(node,transport,wsa_ret)
    routine that anyone could use.


    						MJC