[comp.sys.mac.programmer] TCL CScrollbar & CBorder problem

hertlein@mich.physics.lsa.umich.edu (Marc Hertlein) (06/08/91)

A few days ago I posted an article about my trouble using TCL CScrollBars.
Apparently it was a bit more involved than I thought.

I tracked it down to a certain point, but now I'm not sure whether this is
a problem of the TCL:

I have a CWindow, containing a CPane. Inside it are 3 CScrollbars, 
and a CBorder containing a CPane. I had the trouble that when the program
initially starts up, and nothing is drawn in the interior pane, the
scroll bars don't work properly.
What happens is that after an update event,the last thing that gets
redrawn is apparently the CBorder. Its inside pane is initially empty, so
I don't draw anything in it. Looking at the source code of CBorder,I found
out that its Draw method leaves the Pen in a weird state, namely with a
PenSize of its dropShadow (or its border tickness, if there is no
dropshadow). Now if I try to use my scrollbars, namely drag the thumb, the
thumb outline is drawn with the pen thickness that was set by CBorder!!!

If I don't set any border thickness or dropshadow at all, the CBorder
uses a border thickness of 1. But the scrollbar thumbs don't appear at all
during a drag. As soon as I draw something in my pane, or do anything
which uses PenNormal(), everything is fine again, until a deactivate event
happens, or anything that ultimately will redraw the CBorder.

I realize that all this is a minor bug which can be circumvented by always
setting PenNormal() in my interior Pane's Draw method, but should all this
be happening in the first place? I think scrollbars should work even if
I don't happen to draw anything anywhere. Am I overlooking something
trivial ?

I would appreciate some comments on this, especially on whether I analyzed
all this correctly...

                                           - Marc Hertlein
                                      (hertlein@mich.physics.lsa.umich.edu)