[comp.windows.x] Writing new Widgets under Athena.

spanki@color.ced.berkeley.edu (Frank Goodman) (02/05/90)

I'm having trouble writing a widget. Specifically, I want to set the border
width and border color on my new widget. My widget is a subclass of Core,
and Simple. What steps do I need to take to allow the specification of a
border width for my widget. It is my understanding, that this is already a
fnction of the Core Widget. X doesn't complain when I specify a border width,
but then again, it doesn't display it either. Is there something I need to
do in my Initialize routine (or perhaps SetValues) to make the border show?
I've looked at the code for the Athena Widgets, and I can't figure it out. If
I set the resource:
MyProg*borderWidth: 5 
Then every widget in my application but mine gets a 5 pixel border width. 

I'm lost ?!?!?!?!?!

Thanks in advance,
Frank.

---------------------------------------------------------------------------
Frank  Goodman				arpa:  spanki@CED.Berkeley.EDU
University of California, Berkeley	  or:  spanki%CED@jade.Berkeley.EDU
College of Environmental Design		uucp:  ...hplabs!ucbvax!ced!spanki 
S.I.S Research Laboratory	 	phone: Novelty item, not necessary
---------------------------------------------------------------------------

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (02/06/90)

> Specifically, I want to set the border
> width and border color on my new widget. My widget is a subclass of Core,
> and Simple.

A widget writer can set the default border width for his widget to be a
different value than the one specified in core by just adding a line in the new
widget's resource list for border width.  Take a look at the width resource
specification that is used by the Athena Text widget.

An application writer can either use XtSetValues() or an app-defaults file, or
fallback resources (R4 only) to set the border width for a widget.

A user can set the border width with a line in his resource file (assuming that
the application writer did not hard code in the value with XtSetValues()).

> I set the resource:
> MyProg*borderWidth: 5 
> Then every widget in my application but mine gets a 5 pixel border width. 

This is exactly what is expected, you told that Application to set the border
width to five pixels for each widget in your application.  If you wanted to
specify the border width for a specific widget then use a line like this:

Myprog*myWidget.borderWidth: 5

or this

Myprog.grandParent.parent.myWidget.borderWidth: 5

Take a look at ``doc/tutorials/resources.txt'' and the Athena Widget set manual
section 2.9.2.1.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213