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); }
Amy.Moore@Corp.Sun.COM (Amy) (05/03/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? >> Someone has probably already answered this, but what the heck... Unfortunately, in OLIT, you cannot set individual fonts or background colors for ListItem strings(good "Request for Enhancement" though!). (though you *May* be able to use the glyph to get some color accent) If you look at the structure for the ListItems: /* From ScrollingL.h...*/ typedef struct _OlListItem { /* OPEN LOOK list item */ OlDefine label_type; XtPointer label; XImage * glyph; OlBitMask attr; XtPointer user_data; unsigned char mnemonic; } OlListItem; This shows what attributes you can set on individual ListItems. You can set an item to look 'selected' using the attr field (and you can have multiple, disjoint items selected at once - in 3D they will looked depressed). Below is a code fragment which shows how to set this.... (You probably should consult the docs to better understand all the code - it is sort of obscure). OlListToken token; OlListItem *item = OlListItemPointer(token); void (*ListTouchItem)(); /* Get handle of update routine...*/ XtVaGetValues(scrollinglist, XtNapplTouchItem, (XtArgVal)&ListTouchItem, NULL); /* * Mark the item as selected or current by setting a bit * in its attribute field. Notify the widget that we have * touched an item. */ item->attr |= OL_LIST_ATTR_CURRENT; /* set current attr */ (*ListTouchItem)(scrollinglist, token); /* tell list */ Hope this helps somewhat. Regards, Amy Moore aim@sun.com