Michael Carman wrote:
> Explicit calls to xview() and yview() work but the scrollbar bindings
> don't. I had to replace this:
> 
>   $hsb->configure(-command => [$rotext, 'xview']); 
>   $vsb->configure(-command => [$rotext, 'yview']);
> 
> with this:
> 
>   $hsb->configure(-command => ["$rotext.text", 'xview']); 
>   $vsb->configure(-command => ["$rotext.text", 'yview']);

It occurred to me that a cleaner (if still sub-optimal) solution would
be determining which widget method calls are delegated to and attaching
the callback to it instead. Sort of a "who_would()" method to go along
with can(), isa(), etc. I figured that _mpath() would play a part in
that but after re-reading the docs I saw that _mpath() *is* that method!

This works (and should work for Tkx::Scrolled if I ever get around to
writing it):

  $hsb->configure(-command => [$rotext->_mpath('xview'), 'xview']);
  $vsb->configure(-command => [$rotext->_mpath('yview'), 'yview']);

Normally methods that begin with an underscore are "private." That
hardly seems to be the case with _mpath() though as it's publicly
documented. Is it safe to assume that _mpath() is a *public* method and
this usage doesn't violate encapsulation?

-mjc

Reply via email to