Newsgroups: comp.windows.x
From: stud05@cc4.kuleuven.ac.be (Ton Hospel)
Distribution: world
Date: Friday, 20 Nov 1992 15:28:37 +01
Organization: K.U.Leuven - Academic Computing Center
Subject: Re: Some people record there knowledge.

In article <GATESWK.722138813@CRAFT.CAMP.CLARKSON.EDU>, gateswk@craft.camp.clarkson.edu writes:
>
>
>
> I don't know if anyone out there is like I am but when I am learning stuff
> I tend to keep the basic info in a file so I can look at it and if someone
> wants to know it they can look in that file.  What I'm wondering is if anyone
> has something along these lines on the basic programming of windows in x.
> You know how to open a window and put strings etc in it.  How to make the
> colors different and the geometry and such.  I'm more concerned with
> syntax than anything.  I know the c.  I need the main commands and the parameters that those commands take and the like.  I would appreciate it if someone
> would share some of this info with me.  We have xwindows here at school now
> but to the best of my knowledge we still don't have a course in programming
> them.  Here they are use them....  We run X11R4 and 3 on two different systems
> with Aix 3.1 on one and Aix 3.2 on the other. So if you could help me out
> I'd appreciate it.  Thanx a lot.
>
> Walker
> gateswk@craft.camp.clarkson.edu
>
> If you're ever lost in la la land look me up....
>   I'm sure I'll be there....
>     -Walker
>
> CUL8R and I'm out....
>

If you are just starting X, I would say that you should teach yourself Xt
programming, and not Xlib programming. Xlib  is very nice for rather simple
window programs (you have full control), but as soon as more sophisticated
things are asked, the programs tend to become filled with X details and the
structure gets lost. Better to use the toolkit and some widgetset (I prefer the
athena 3d widgets (Xaw3d), but others are fine too). This allows you to
concentrate on the structure of your program and the structure of whatever
you want to display. It also makes configurability so much easier (it should
take care of almost all your color and geometry problems, since you can set
reasonable defaults in a very simple way, and the user can still change them if
(s)he prefers). Label, command an text widgets (or the equivalent in other
toolkits) should solve most of your text related problems. Xt has one drawback:
the code size grows a lot (not a real problem on systems with lots of memory or
shared libraries).

Drawing (the thing most beginning X programmers want to do) can be done in some
sort of canvas widget (I can send you my Xaw/Xaw3d version if you want). In the
window of this widget you can do all your normal X drawing stuff (so you'll
still have to learn a bit about that).

For documentation, I refer you to the X FAQ, which is very good (it was posted
recently, otherwise look in news.answers). Once you have read some starter
book(s) to understand the concepts, you can find almost anything you want
to know in the documentation that should be online in the files intrinsics.man,
widgets.man, xlib.man and xmu.man (if you don't have them, ftp them from
export.lcs.mit.edu). If you don't want a paper copy, these can take the place
of a reference manual (and you can print them out of course).

Examples can be found on the ftp site export.lcs.mit.edu in the directory
/pub/R5untarred/contrib/examples . I learned a lot from the examples in Xaw
subdirectory there when I was starting with X.

Hope this helps, and also gets other people to consider using Xt instead of
Xlib (These Xlib programs tend to be unconfigurable. It's also terrible to have
to understand/change some Xlib programs, while with an Xt program rarely
presents a problem).

                                                               Ton



Newsgroups: comp.windows.x