| #include <stdio.h>
#include <decw$include/DECwDwtApplProg.h>
#include <decw$include/DwtAppl.h>
#include <decw$include/Vendor.h>
#include <decw$include/Intrinsic.h>
static DRMHierarchy s_DRMHierarchy; /* DRM database hierarch id */
static char *vec[]={"list.uid"};
/* DRM database file list */
Display *display; /* display pointer */
static DRMCode class ;
Widget toplevel, helloworldmain, list;
/*
* Main program
*/
int main(argc, argv)
unsigned int argc;
char **argv;
{
Arg arglist[10] ;
int n = 0;
if (! (display = XOpenDisplay(NULL)))
{
fprintf (stderr, "Can't open display\n");
}
DwtInitializeDRM ();
toplevel = XtInitialize(
"Hi", /* application name */
"helloworldclass", /* application class */
NULL, 0, /* options */
&argc, argv); /* command line parameters */
XtSetArg (arglist[n], DwtNx, 50) ; n++;
XtSetArg (arglist[n], DwtNy, 50) ; n++;
XtSetArg (arglist[n], XtNallowShellResize, True) ; n++;
XtSetValues (toplevel, arglist, n) ;
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");
}
if (DwtFetchWidget (s_DRMHierarchy,
"helloworld_main",
toplevel,
&helloworldmain,
&class)
!= DRMSuccess)
printf("can't fetch interface");
list = XtNameToWidget (helloworldmain, "helloworld_main.helloworld_list");
n=0;
XtSetArg (arglist[n], DwtNshownValueAutomaticVert, True) ; n++;
XtSetValues (list, arglist, n) ;
XtManageChild(helloworldmain);
XtRealizeWidget(toplevel);
/* Get the widget id's to install the accelerator */
XtMainLoop();
}
|
| module helloworld
version = 'v1.0'
names = case_sensitive
include file 'decw$include:DECwDwtApplProg.uil';
value
list_text :
string_table ('Apple Juice', 'Orange Juice', 'Grape Juice',
'Cola', 'Punch','Root beer', 'Water',
'Ginger Ale', 'Milk', 'Coffee');
list_select :
string_table('Apple Juice','Orange Juice');
object
helloworld_main : main_window {
arguments {
x=50;
y=50;
width=0;
height=0;
};
controls {
list_box helloworld_list;
};
};
object
helloworld_list : list_box {
arguments {
x = 5;
y = 25;
visible_items_count=10;
items = list_text;
single_selection = true;
};
};
end module;
|