Help with OpenWindows

Isa Hashim isa at eng.sun.com
Sat Mar 3 12:12:03 AEST 1990


The usage of font attributes in xv_create() is correct in the posted
example.  However, the usage of PANEL_LABEL_FONT on the PANEL_BUTTON has
some problems:

PANEL_LABEL_FONT is a 'compatability' attribute i.e. it exists for SunView
compatability reasons, but is not really supported. The attribute that
should be used is XV_FONT.

Also, you can set the font for a PANEL which will make all the Panel items
use it, but you cannot set fonts for individual Panel items.  This is
because according to OPEN LOOK, all Panel items must have the same font.
Panel items simply ignore font attributes.

The solution is to use the attribute XV_FONT on the PANEL and not on the
PANEL_BUTTON. The entire corrected program is included below.

As far as documentation is concerned, one source is:

	"XView Programming Manual"

	O'Reilly & Associates, Inc.
	632 Petaluma Avenue
	Sebastopol, CA  95472
	(800)338-6887  [from within the USA]
	(707)829-0515
	FAX: (707)829-0104
	EMAIL: uunet!ora!xview

Additional documentation in PostScript source format exists online with the
XView source:

	"XView 1.0.1 Reference Manual: Converting SunView Applications"
	"Converting Your SunView Application's Pixwin/Pixrect Graphics
	to XView and Xlib Graphics"

A pre-printed version of the XView 1.0.1 reference manual can be ordered
(at the cost of media and shipping) from Sun Microsystems by ordering Part
Number 800-2482-10. (Call the Sun sales office or telemarketing
1-800-USA-4SUN)

Hope this helps.
Please let me know of other problems you might have concerning this.

Isa Hashim
XView toolkit group
isa at sun.com

    #include	<stdio.h>
    #include	<xview/xview.h>
    #include	<xview/panel.h>
    #include	<xview/font.h>

    main(argc, argv)

    int	argc;
    char	**argv;

    {	Frame	frame;
	    Panel	panel;
	    Xv_font	font;

	    xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);
	    font = xv_create(NULL, FONT,
				FONT_FAMILY, FONT_FAMILY_LUCIDA,
				FONT_SIZE, 14,
				FONT_STYLE, FONT_STYLE_BOLD_ITALIC,
			     0);
	    frame = xv_create(NULL, FRAME, XV_LABEL, "A simple window", 0);
	    panel = xv_create(frame, PANEL,
			         XV_FONT, font,
				 XV_WIDTH, 400,
				 XV_HEIGHT, 200,
			      0);
	    xv_create(panel, PANEL_BUTTON,
			 PANEL_LABEL_STRING, "A Button",
		      0);
	    window_fit(frame);
	    window_main_loop(frame);
    }



More information about the Comp.sys.sun mailing list