[comp.windows.open-look] Need help with Xview PANEL_CHOICE_ITEM fonts.

cowan@soleil.sps.mot.com (Andrew H Cowan) (06/06/91)

Can't two panels in an Xview frame have different fonts?

In the following program I'm trying to get two selection choice panel
items in the same frame to come up in two different fonts.  I've tried
all manner of setting "PANEL_FONT", and "PANEL_CHOICE_FONTS", using
multiple panels, etc., to no avail.

Can anyone explain to me what I'm doing wrong?

Can anyone explain how I can get a list of choices to come up in a
small font. (I have a need to show a LOT of selection choices on the
screen, thus a small font is required.)

(The following code, compiles and executes on a Sun 4 SunOS Release
4.1.1 system.)

        **                   /   \                   **
     ** **                  |     |                  **
     ** ** **                \___/                   ** **
     ********                                        ** **
      ******         __                  **          ****
        **        \_/oo\_/              ****         **
........**..........\||/................****.........**...........
Andy Cowan...........||.............cowan@soleil.sps.mot.com......

================= cut here =====================
/*  This program does nothing more than:
	1) creates a frame,
	2) creates two panels in the frame,
	3) the first panel gets a quit button and
	   a list of choice items.
	4) creates a 5x8 font,
	5) the second panel gets another
	   list of choice items, both the panel
	   and the choices are set to use the
	   5x8 font.

To compile:

cc -g -I/usr/openwin_2/sun4/include  -target sun4 -o test  \
   -L/usr/openwin_2/sun4/lib -lolgx -lxview -lX11 thisfile.c
   -L/usr/openwin_2/sun4/lib -lxview -lX11 -lolgx thisfile.c

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

Frame Toplevel;   
Panel PanelOne;        
Panel PanelTwo;        
void quit(){ xv_destroy_safe( Toplevel ); }

main(argc, argv)
int argc;
char *argv[];
{
   Xv_font font;
   Xv_font font2;

   xv_init( XV_INIT_ARGC_PTR_ARGV, &argc, argv, NULL );

   Toplevel = (Frame) xv_create( NULL, FRAME,
	XV_HEIGHT, 100,
	NULL );

   /* Create a font to use in the first panel */
   font = (Xv_Font )xv_find( Toplevel, FONT, FONT_NAME, "5x8", NULL );

   /* Create a panel for Quit button and first selection choices. */
   PanelOne = (Panel) xv_create( Toplevel, PANEL, 
	PANEL_FONT, font,
	NULL ); 
   (void)xv_create( PanelOne, PANEL_BUTTON,
	PANEL_LABEL_STRING, "Quit",
	PANEL_NOTIFY_PROC, quit,
	NULL );
   (void)xv_create( PanelOne, PANEL_CHOICE,
	PANEL_CHOICE_STRINGS , "These","should","be","in","5x8","font", NULL,
	NULL);
   /* Create a font to use in the second panel */
   font2 = (Xv_Font )xv_find( Toplevel, FONT, FONT_NAME, "7x13", NULL );

   /* Create a panel for second bunch of selection choices. */
   PanelTwo = (Panel) xv_create( Toplevel, PANEL, 
	XV_Y, 50,
	PANEL_FONT, font2,
	NULL ); 
   (void)xv_create( PanelTwo, PANEL_CHOICE,
	PANEL_CHOICE_STRINGS , "These","should","be","in","7x13","font.","Why","not???", NULL,
	NULL);

   window_fit( Toplevel );

   xv_main_loop( Toplevel );
}