[comp.sys.sun] How to create custom panel items in suntools?

roy@phri.nyu.edu (Roy Smith) (04/26/89)

Perhaps I've simply missed where it describes how to do this in the
manual, but I can't figure out if there is any way to create your own
panel item types.  Is it possible?

For example, I've designed a sort of floating-point slider which consists
of a regular slider going from 1.00 to 9.95, a choice item (with a menu
behind it) to pick an power-of-ten, and a text item to display the current
value.  The next frill to add is being able to edit the text item directly
and have the slider and choice change in response.  You've all seen this
type of thing on Macs many times.

The problem is that I've got to create three different panel items and
deal with the interactions between the three of them myself.  It would be
much nicer if I could simply define this as a composite panel item, and
then be able to just panel_creat_item() one of them.  The item would take
care of the interactions between the parts of the composite item and I'd
just find out about the new value without having to worry about updating
the text item to match the slider or update the slider to match the text
item, etc.

Yeah, yeah, I know, it's easy to do this in NeWS, but I want to do it in
suntools because that's what everybody around here runs.

Roy Smith, System Administrator
Public Health Research Institute
{allegra,philabs,cmcl2,rutgers,hombre}!phri!roy -or- roy@phri.nyu.edu
"The connector is the network"

chuck@trantor.harris-atd.com (Chuck Musciano) (05/09/89)

     Suntools is not extensible (XView doesn't seem to be either, at first
glance).  I once tried to create a scrollbox panel item, and almost got it
wokring before I got distracted with other things.  

     I would simply package your new gadget as a separate module, with a few 
well defined interface routines, and use it like that.  Of course, you can't
call panel_create_item(), but you could have a routine called 
panel_create_custom_slider or whatever that honored all the panel attributes
and used varargs to make it look just like the normal routine.  Then you can
document the whole thing and send it to the sun archives for the rest of us :-)


Chuck Musciano			ARPA  : chuck@trantor.harris-atd.com
Harris Corporation 		Usenet: ...!uunet!x102a!trantor!chuck
PO Box 37, MS 3A/1912		AT&T  : (407) 727-6131
Melbourne, FL 32902		FAX   : (407) 727-{5118,5227,4004}