[comp.windows.x] Open Look Scrolling List help!!!

kkirksey@eng.auburn.edu (Kenneth B. Kirksey) (05/01/91)

Is there an easy way (or any way at all) to specify fonts for the individual
elements in a Open Look Scrolling List widget?  Can you set background colors
for the individual elements?  I'm writing an application that I need to 
have certain elements in a scrolling list highlighted in some way.  Is this
possible?

			Thanx in advance,
                                 Ken
+---------------------------+------------------------------------------------+
| Ken Kirksey               | "Any government that robs Peter to pay Paul    |
| Computer Engineering      |  can always count on the support of Paul"	     |
| Auburn University         |                                                |
| kkirksey@eng.auburn.edu   |                        -Robert A. Heinlein     |
+---------------------------+------------------------------------------------+

warsaw@nlm.nih.gov (Barry A. Warsaw) (05/02/91)

>>>>> "Ken" == Kenneth B. Kirksey <kkirksey@eng.auburn.edu> writes:

	Ken> Is there an easy way (or any way at all) to specify fonts for
	Ken> the individual elements in a Open Look Scrolling List widget?

You don't say which Open-Look toolkit you're using.  For XView, try
setting the PANEL_LIST_FONTS parallel list.  Truncated parallel lists
don't work for this attribute, and the single PANEL_LIST_FONT may or
may not work (can't remember if its buggy or not).

	Ken> Can you set background colors for the individual elements?

Not that I know of (but that don't mean a whole lot ;-).

-Barry

helvie@EBay.Sun.COM (Fred Helvie) (05/02/91)

kkirksey@eng.auburn.edu (Kenneth B. Kirksey) writes:

>Is there an easy way (or any way at all) to specify fonts for the individual
>elements in a Open Look Scrolling List widget?  Can you set background colors
>for the individual elements?  I'm writing an application that I need to 
>have certain elements in a scrolling list highlighted in some way.  Is this
>possible?

for fonts use the attribute:

	PANEL_LIST_FONTS, font1, font2, ..., 0,

I'm not sure about "highlighting" an item, but you can "select" it:

	PANEL_LIST_SELECT, row, boolean,

follows is some code.

Fred Helvie
Sun Education


------ cut here -----

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


main(argc,argv)
int argc;
char **argv;
{
	Frame 		frame;
	Panel 		panel;
 	Panel_item	list_item;
	Xv_Font		f1, f2, f3;
	int 		list_proc();

	(void)xv_init(XV_INIT_ARGC_PTR_ARGV, &argc, argv, 0);


	frame = xv_create(XV_NULL, FRAME_BASE,
			XV_LABEL, "List Fonts",
			0);

	panel = xv_create(frame, PANEL, 0);

	f1 = xv_find( frame, FONT,
			FONT_NAME, "screen-bold-12",
			0 );

	f2 = xv_find( frame, FONT,
			FONT_NAME, "lucidasans-italic-10",
			0 );

	f3 = xv_find( frame, FONT,
			FONT_NAME, "courier-14",
			0 );

	list_item = xv_create(panel, PANEL_LIST,
			PANEL_CHOOSE_ONE,	FALSE,
			PANEL_LIST_WIDTH,	100,
			PANEL_LABEL_STRING,	"List Item",
			PANEL_LIST_DISPLAY_ROWS, 3,
			PANEL_LIST_STRINGS, 
				"One", "Two", "Three", 0,
			PANEL_LIST_FONTS, 
				f1, f2, f3, 0,
			0);

	xv_set(list_item,
			PANEL_LIST_SELECT, 0, 1,
			PANEL_LIST_SELECT, 2, 1,
			0);

	window_fit(panel);
	window_fit(frame);
	xv_main_loop(frame);
}