Path: utzoo!attcan!uunet!pcrat!rick From: rick@pcrat.uucp (Rick Richardson) Newsgroups: comp.windows.x.motif Subject: Re: Stretchable List Summary: Neverrrrrrrr Miiiiiiiiind (Solution Enclosed) Message-ID: <1990Jul16.223021.11654@pcrat.uucp> Date: 16 Jul 90 22:30:21 GMT References: <1990Jul16.172955.11321@pcrat.uucp> Reply-To: rick@pcrat.UUCP (Rick Richardson) Organization: PC Research, Inc., Tinton Falls, NJ Lines: 147 In article <1990Jul16.172955.11321@pcrat.uucp> rick@pcrat.uucp (Rick Richardson) writes: >I'm trying to make a Form that contains some buttons at the >top, and a scrollable list of things at the bottom. I think I've answered my own question. I gave up on using the widget with the enticing name ScrolledList. Instead, I used the raw ScrolledWindow, at first with a List inside it, then with a Form inside it. The Form contains a Label and a List, which is better for what I wanted to do, anyway. I did run into what I'd consider another bug, which you can read about in the UIL comments. Thanks to all those people who I'm sure were ready to point me in the right direction. If you still want to, feel free to comment on my use of UIL (modulo bracing and indenting). -Rick P.S. Filling in the list creation C code, and the pushbutton callback is an exercise for the reader. If you haven't used UIL before, snag the fairly generic hellomotif.c scaffold from /usr/lib/X11/examples. I think the theory is that a Human Factors person is supposed to be able to write UIL and run it against the scaffold. When the whole interface is fleshed out, it becomes the input to a programmer who writes the C code to make it really do that, using most of the UIL as supplied from Human Factors. Of course, the UIL manual isn't written to be readable by those folks, and is barely readable by a programmer, so the theory may be shot full of holes. Specific complaint: dump the BNF into an appendix, and replace with examples. OSF: Feel free to use this one. ! ! Sample UIL specification of a stretchable list, with header ! module fr version = 'v1.0' names = case_sensitive include file 'XmAppl.uil'; object ft_main : XmForm { controls { XmPushButton kill_button; XmScrolledWindow scroll_window; }; arguments { XmNheight = 200; XmNwidth = 300; }; }; object kill_button : XmPushButton { arguments { XmNtopAttachment = XmATTACH_FORM; XmNleftAttachment = XmATTACH_FORM; XmNrightAttachment = XmATTACH_FORM; XmNlabelString = "Select a Process to Kill, Then Push Me"; }; }; object scroll_window : XmScrolledWindow { controls { XmForm scroll_form; }; arguments { XmNtopAttachment = XmATTACH_WIDGET; XmNtopWidget = XmPushButton kill_button; XmNleftAttachment = XmATTACH_FORM; XmNrightAttachment = XmATTACH_FORM; XmNbottomAttachment = XmATTACH_FORM; XmNscrollingPolicy = XmAUTOMATIC; XmNvisualPolicy = XmCONSTANT; XmNworkWindow = XmForm scroll_form; }; }; object scroll_form : XmForm { controls { XmLabel scroll_header; XmList scroll_list; }; }; ! ! Although it is tempting to put ???Attachment constraints ! on scroll_header and scroll_list, don't do it. It triggers ! some kind of bug in Motif, and the scroll_list gets trashed. ! It seems to do 'the right thing' without them (luckily). ! object scroll_header : XmLabel { arguments { XmNlabelString = " UID PID PPID C STIME TTY TIME COMMAND "; ! XmNtopAttachment = XmATTACH_FORM; ! XmNleftAttachment = XmATTACH_FORM; }; }; value scroll_list_items : exported string_table ( " root 0 0 0 Jul 10 ? 0:03 sched", " root 1 0 0 Jul 10 ? 3:50 /etc/init ", " root 2 0 0 Jul 10 ? 4:08 vhand", " root 3 0 0 Jul 10 ? 3:21 bdflush", " root 97 1 0 Jul 10 console 0:01 /etc/getty console console ", " rick 101 1 0 Jul 10 vt01 0:19 -ksh ", " root 9124 1 0 16:43:46 ttyp0 0:01 /etc/faxsrv ", " root 9125 9124 0 16:43:46 ttyp0 0:01 faxrun1 -Tjfax -D/dev/jfax0", " root 9126 9124 0 16:43:46 ttyp0 0:01 faxrun2 -Tbfax -D/dev/bfax0", " root 9127 9124 0 16:43:47 ttyp0 0:01 faxrun3 -Tbfax -D/dev/bfax1", " root 9128 9124 0 16:43:47 ttyp0 0:03 faxrun4 -Tefax -D/dev/tty00", " root 9129 9124 0 16:43:48 ttyp0 0:03 faxrun5 -Tefax -D/dev/tty01", " root 75 1 0 Jul 10 ? 0:21 /etc/cron ", " root 79 1 0 Jul 10 ? 0:38 /usr/lib/lpsched ", " root 6242 1 0 Jul 14 vt02 0:00 /etc/getty /dev/vt02 vt02 ", " root 6243 1 0 Jul 14 vt03 0:00 /etc/getty /dev/vt03 vt03 ", " root 6244 1 0 Jul 14 vt04 0:00 /etc/getty /dev/vt04 vt04 ", " rick 8300 101 0 23:42:07 vt01 0:00 xinit ", " rick 8301 8300 9 23:42:07 vt05 7:05 X :0 ", " rick 8302 8300 3 23:42:13 ? 1:27 xterm -geometry 80x24+0+0", " rick 8303 8302 0 23:42:14 ? 0:23 /usr3/bin/X11/uwm ", " rick 8304 8302 1 23:42:19 ttyp0 0:09 ksh " ); object scroll_list : XmList { arguments { ! XmNtopAttachment = XmATTACH_WIDGET; ! XmNtopWidget = XmLabel scroll_header; ! XmNleftAttachment = XmATTACH_FORM; ! XmNrightAttachment = XmATTACH_FORM; ! XmNbottomAttachment = XmATTACH_FORM; XmNitems = scroll_list_items; XmNitemCount = 22; XmNvisibleItemCount = 22; }; }; end module; -- Rick Richardson | Looking for FAX software for UNIX/386 ??? Ask About: |Mention PC Research,Inc.| FaxiX - UNIX Facsimile System (tm) |FAX# for uunet!pcrat!rick| FaxJet - HP LJ PCL to FAX (Send WP,Word,Pagemaker...)|Sample (201) 389-8963 | JetRoff - troff postprocessor for HP LaserJet and FAX|Output