Newsgroups: comp.windows.open-look,alt.toolkits.xview,comp.windows.news,alt.sys.sun,alt.toolkits.intrinsics,comp.answers,alt.answers,news.answers
From: lee@sq.sq.com (Liam Quin)
Subject: OPEN LOOK GUI FAQ 03/04: the XView Toolkit
Message-ID: <liamfaq-ol3-36@sq.com>
Summary: FAQ for the freely available XView X Windows toolkit
Reply-To: lee@sq.com (Liam R. E. Quin)
Organization: SoftQuad Inc., Toronto, Canada
Date: Mon, 24 Apr 95 22:06:17 GMT
Approved: news-answers-request@MIT.EDU
Expires: 24 May 1995 02:49:16 GMT

Archive-name: open-look/03-xview


This is a new FAQ.

Contributions will be welcomed; mail them to lee@sq.com (Liam Quin),
preferably including "XView FAQ" in the Subject line.

Contents:
    Sources Of Information:
    The Future of XView
    Scrolling Lists
    How do I keep a pop-up window displayed after a button is pressed?
    how do I make an XView button look pressed?
    OpenWindows 3 imake doesn't work properly
    The pop-up menu in my canvas has funny colours
    The second ttysw in my program doesn't work
    How do arrange to have a (Cancel) button to stop a calacuation?
    How do I put panel items on a canvas?


Subject: Sources Of Information:
    netnews newsgroups:
	alt.toolkits.xview	- best for specific XView questions
	comp.windows.open-look
	comp.windows.x		- highest volume
    Watch for Frequently Asked Questions lists (such as this) in these
    groups.  The article you are reading is part of the alt.toolkits.xview
    and comp.windows.open-look FAQ.

    Books:
	See the comp.windows.open-look FAQ, which lists several books on X
	and XView.  The O'Reiily books in particular are recommended.
    
    Source: code:
	the FTP site export.lcs.mit.edu, in directory /contrib, has the
	full XView source (the latest release is 3.2), together with lots
	of X programs.  Programs whose name ends in "tool" or starts with
	"xv" are often based on XView.

Subject: The Future of XView

    XView is no longer a Strategic Direction for Sun.  It will be supported
    for the next few years, but new features will not be added.
    On the other hand, the source is publicly available.
    XView is included with SunOS and Solaris, and also with some versions
    of Linux.

    Sun will be moving to a motif-like user interface in 1995, with the
    shipping of COSE/CDE.  At that time, XView will be less interesting to
    many people.

    Since it's probably the easiest X toolkit to use that's easily and
    widely available, XView will probably be widely used for a while.



Subject: Scrolling Lists

@ How do I set the font of individual Scrolling List items?
    PANEL_LIST_FONT takes an int row_number and an Xv_opaque font_handle.
    PANEL_LIST_FONTS take a NULL terminated list of Xv_opaque font_handles.
    There is no easy way to make an entire list fixed width font.
    You have to make sure that you always specify PANEL_LIST_FONT when you
    insert a new row into that list, or write a convenience function
    insert_row(list, row, string) that hides the nasty bits.
    The most efficient way to do this involves creating an Xv_attr array
    to do lots of insertions at once, complete with PANEL_LIST_FONTs.

    If you give both PANEL_LIST_STRING and PANEL_LIST_FONT in the same
    xv_set() call, PANEL_LIST_STRING must be given first, or the default
    font will be used.

@ How do I set the selected item of an exclusive list with required choice?
    If you have a PANEL_LIST with a required choice, and the list is
    exclusive, you must de-select the old item and select the new one in
    a single xv_set() call, for example:

	xv_create(owner, PANEL_LIST,
	    ....
	    PANEL_CHOOSE_ONE, TRUE,    /* only one entry can be selected */
	    PANEL_CHOOSE_NONE, FALSE,  /* one entry must be selected	  */
	    NULL
	);

	xv_set(List,
	    PANEL_CHOOSE_NONE, TRUE,
	    PANEL_LIST_SELECT, xv_get(List, PANEL_LIST_FIRST_SELECTED), FALSE,
	    PANEL_LIST_SELECT, row, TRUE,
	    PANEL_CHOOSE_NONE, FALSE,
	    NULL
	);

    Note: you may find it useful to start with PANEL_CHOOSE_NONE true so that
    the list comes up with no selection; and then on the first selection set
    PANEL_CHOOSE_NONE to FALSE so that a selection is required.



Subject: How do I keep a pop-up window displayed after a button is pressed?
    In the button callback, do
        xv_set(button, PANEL_NOTIFY_STATUS, XV_ERROR, NULL);
    This will keep the window visible.
    You might also need to investigate the MENU_NOTIFY_STATUS attribute.

Subject: how do I make an XView button look pressed?
    call panel_begin_preview() and panel_cancel_preview(); these are
    documented in -- er -- the XView 3 source...

Subject: OpenWindows 3 imake doesn't work properly
    Here is Greg Earle's patch, to be applied in $OPENWINHOME; note that you
    should edit lib/config/sun.cf afterwards to get OSName and
    OSMinorVersion right (MinorVersion is 1 in SunOS 4.1.2, for example).
    I have edited the patch a little, so any bugs are mine [lee@sq.com] :-)
 
*** bin/xmkmf.orig	Wed Sep 18 07:02:02 1991
--- bin/xmkmf	Tue Aug  6 00:39:20 1991
***************
*** 30,34 ****
  
  elif [ -n "$OPENWINHOME" ]; then
! 	args="-DUseInstalled $OPENWINHOME/lib/config"
  
  else
--- 30,34 ----
  
  elif [ -n "$OPENWINHOME" ]; then
! 	args="-I$OPENWINHOME/lib/config -DUseInstalled -DXCOMM='/**/#'"
  
  else
*** lib/config/site.def.orig	Wed Sep 18 01:26:19 1991
--- lib/config/site.def	Tue Aug  6 00:44:37 1991
***************
*** 0 ****
--- 1,7 ----
+ #define BinDir $(OPENWINHOME)/bin
+ #define LibDir $(OPENWINHOME)/lib
+ #define IncRoot $(OPENWINHOME)/share/include
+ #define InstallNonExecFile(file,dest)					@@\
+ install:: file								@@\
+ 	$(INSTALL) -c $(INSTDATFLAGS) file dest
+ #define NullParameter


Subject: The pop-up menu in my canvas has funny colours
    You need to use CMS_CONTROL_CMS when you create the CMS for your canvas.
    This allocates the OPEN LOOK UI 3D colors at the start of the colormap.
    The foreground color lives right at the end.

Subject: The second ttysw in my program doesn't work
    XView only supports one ttysw per program!

Subject: How do arrange to have a (Cancel) button to stop a calacuation?
    When you are doing cpu-intensive calculations, your program probably
    isn't calling the XView notifier, so that button presses aren't noticed
    until the computation is over.
    There are several possible solutions:
    * use the implicit or explicit notify displatch mechanism, described
      in the Notifier chapter of the XView Programming Manual (O'Reilly);
    * use multiple processes, and send signals;
    * split up the work into small chunks and use notify_stop to return to
      the main loop for each chunk.

Subject: How do I put panel items on a canvas?
    You don't.
    You can, however, draw on a panel, as if it was a canvas.
    Another alternative is to use olgx to render the controls, but this is
    a little tricky.


END of XView FAQ

# $Id: ol3.faq,v 1.2 1994/09/02 22:08:38 lee Exp $

-- 
Liam Quin, SoftQuad Inc +1 416 239 4801 lee@sq.com   <URL:http://www.sq.com/>
HexSweeper NeWS game;OPEN LOOK+XView+mf-fonts FAQs;lq-text unix text retrieval
SoftQuad HoTMetaL/HTML Editor; SoftQuad Panorama/WWW SGML Viewer
See our Web page for HoTMetaL ftp sites... 
