I am working with ttk::paned window and I see that I can change the
relative sizes of the panes by doing a Button1-drag on the sash. For
various reasons, I would like to assign that action to a different
mouse event like Control-Button3-Drag. Is that possible and how
would I do it? If I can do that is it then possible to later restore
the normal behavior?
I apologize if this is not a well formed or expressed question.
A side question that really does not require an answer. How come the
sash is not denoted by some separator symbol like most other paned
windows?
Thanks in Advance,
Don
Yes, look at the bindings on the class TPanedwindow. Create a new set of
binding on say MyTPanedwindow. Then use bindtags to change which set of
bindings apply at which times.
Read (at least) the following man/help pages:
bind
bindtags
lreplace
lsearch
> I apologize if this is not a well formed or expressed question.
>
> A side question that really does not require an answer. How come the
> sash is not denoted by some separator symbol like most other paned
> windows?
The themed widgets attempt to use the native widget implementation. So to
answer your question we first need to ask: which platform you are on and
whqt theme you are using?
--
+------------------------------------------------------------------------+
| Gerald W. Lester |
|"The man who fights for his ideals is the man who is alive." - Cervantes|
+------------------------------------------------------------------------+
Thanks for your quick response. I will try your suggestion.
At the moment I am writing for Linux and have been using the default
theme. I would like my program to be usable from Windows as well. I
was hoping it would just run on the other two platforms (Windows and
OSX). I was surprised that all four of the themes that ship with ttk
are black on gray.
Thanks again,
Don
I apparently didn't understand, I tried the following but could not
move the sash with B3.
ttk::panedwindow .p -orient horizontal
ttk::labelframe .p.f1 -text Pane1 -width 100 -height 100
ttk::labelframe .p.f2 -text Pane2 -width 100 -height 100
.p add .p.f1
.p add .p.f2
pack .p
update idletasks
puts "bind TPanedwindow B1-Motion: [bind TPanedwindow <B1-Motion>]"
bind .p <B3-Motion> [bind TPanedwindow <B1-Motion>]
puts "bind .p B3-Motion: [bind .p <B3-Motion>]"
Again, any suggestions would be much appreciated.
Thanks,
Don
You also need to duplicate the bindings for <ButtonPress-1>
and <ButtonRelease-1>.
[ earlier ]
>> > If I can do that is it then possible to later restore
>> > the normal behavior?
Do you want your paned windows to work with button 3
*in addition to* button 1, or *instead of* button 1?
If the latter, you can disable button 1 dragging by
clearing the bindings:
bind TPanedwindow <ButtonPress-1> {}
bind TPanedwindow <B1-Motion> {}
bind TPanedwindow <ButtonRelease-1> {}
(If you want to be able to change this back later,
remember to save the original bindings someplace safe).
Also: do you want all panedwindows in your app to work the same way,
or do you only want certain ones to use button 3 dragging?
If the latter, then you should use a different bindtag:
ttk::copyBindings TPanedwindow MyPanedwindow ;# [see note]
... [bind MyPanedwinow ... etc...] ... as before
and either use:
ttk::panedwindow $pw -class MyPanedwindow ...
or manipulate [bindtags $pw] as Gerald suggested earlier.
(Note: [ttk::copyBindings] is recommended because the
panedwindow widget has other bindings unrelated to
dragging sashes.)
>> > A side question that really does not require an answer. How come the
>> > sash is not denoted by some separator symbol like most other paned
>> > windows?
It does in some themes, not in others. The default theme under X11
is very sparse with few decorative elements.
--Joe English