Sujet : Re: ttk::panedwindow possible enhancements
De : wortkarg3 (at) *nospam* yahoo.com (Harald Oehlmann)
Groupes : comp.lang.tclDate : 30. Jan 2025, 09:18:54
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vnfcle$2rhtb$1@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
Am 28.01.2025 um 02:08 schrieb Emiliano:
On Fri, 24 Jan 2025 11:56:25 +0100
Harald Oehlmann <wortkarg3@yahoo.com> wrote:
Dear Tk experts,
>
please allow me to ask for opinions on the ttk::panedwindow widget.
>
IMHO it may get some love.
>
My main challenges:
>
1) in vista theme, the Sash is invisible. There is just a 3 pixel width
line which changes the cursor, if the mouse hoovers over it.
Users may easily overlook it, specially, if the sash is at position 0 or
adjacent to another sash.
Dear Harald:
I don't know about native themes (win and macos), but I can get a grip
on the default themes on X11 with the following code:
image create photo ::ttk::defaultvgrip -data {
iVBORw0KGgoAAAANSUhEUgAAAAUAAAAbCAYAAAC0s0UOAAAABmJLR0QA/wD/AP+gvaeTAAAA
CXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH6QEbFwcqynTzIAAAAKNJREFUKM/ljzEKwkAQ
Rd/OBlwLJWBnIShqioCNp7D0CF7Q0oMIFltEECFWU1gZMGssDAYkFtb+dt6fxzeqymcigMFw
mCCSEqzXy+kgr5udUJkVNiRvEkLGQ3YQPIBp+ym0pSb7ODcijmNVrUnXW4BsKIplUy/vBoio
rDT2srsnup1xnetv9nrmeArlHEKmee5rspxhWCOS/uFMT2W3VNHxq+gJ3RFb4/EnHL0AAAAA
SUVORK5CYII=
}
image create photo ::ttk::defaulthgrip -data {
iVBORw0KGgoAAAANSUhEUgAAABsAAAAFCAYAAAC0CJe+AAAABmJLR0QA/wD/AP+gvaeTAAAA
CXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH6QEbFxAG/S8bVQAAAJtJREFUKM+90T0OgkAQ
huF3fwzbqaGjVAMFiZcw8QBe1t4j2BEVu+2mEAsoWLDQrDUNU06e5JsfJSLMVRYgzbINmALs
TfzzDpCmuyW23WMXI937KiLNz+ZgttNsqMX7Sn8zTYHiBH0ex3DtGquPEA44t4r9UZeTrdZl
3AxMjerPjMMjwiR50fUXVBhwrvkfI1QooybZYCoANefPPoUQTj/QmFn/AAAAAElFTkSuQmCC
}
ttk::style theme settings default {
ttk::style element create Sash.vgrip image ::ttk::defaultvgrip
ttk::style element create Sash.hgrip image ::ttk::defaulthgrip
ttk::style layout Vertical.Sash {
Sash.vsash -sticky nswe -children {
Sash.vgrip -sticky {}
}
}
ttk::style layout Horizontal.Sash {
Sash.hsash -sticky nswe -children {
Sash.hgrip -sticky {}
}
}
}
ttk::style theme settings classic {
ttk::style layout Vertical.Sash {Sash.vsash -sticky ns}
ttk::style layout Horizontal.Sash {Sash.hsash -sticky we}
}
For better scaling, svg grip images can be used.
2) if there is a resize by sash drop, I want to get a callback to save
the sash position for later restoring.
>
3) if there is a sash drag, I want to control the valid values. For
example, always make a part of the window visible (like a tablelist
title row).
>
4) I would love to attach additional functionality to the sash, like
right click->menu or double-left-click->zoom.
>
I suppose, 2-4 may be solved by exposing the widget name of the sash.
For point 1, I hope magic Csaba may look into it.
All this behaviour is scripted, and it can be changed easily. See the
procs in ::ttk::panedwindow namespace, specially Press (bound to <Button-1>),
Drag (<Button1-Motion>), Release (ButtonRelease-1) and SetCursor (<Motion>).
For points 2) and possibly 3), a virtual event can be used. For point 4), just
use [bind].
While we are here, I want just another possibility: collapsible panedwindows.
For an idea of what I'm talking about, see the panedwindow handle of
Libreoffice's docked Navigator at
https://wiki.documentfoundation.org/images/thumb/3/33/202202EN_Navigator_01_edited.png/300px-202202EN_Navigator_01_edited.png
at the left of Hyperlinks. If dragged, it behaves as a standard panedwindow.
But if single clicked, it collapses to the right, hiding the Navigator.
It also changes the direction of the arrow from right to left.
Just food for thought.
Dear Emiliano,
thanks for the message, that is great!
IMHO it would be great to have a sash graphics by default for all themes.
And yes, a possibility to put buttons on the sash would also be great.
I am aware that all behaviour can be changed by internal bindings etc, but nothing is documented and an official interface for those points may be great.
I can also imaging scrollwheel bindings on the sash, like "collapse up/down".
Thanks for all,
Harald