Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

Loose bits sink chips.


devel / comp.lang.tcl / Re: I find moving panedwindows very frustrating

SubjectAuthor
* I find moving panedwindows very frustratingLuc
`- I find moving panedwindows very frustratingHarald Oehlmann

1
I find moving panedwindows very frustrating

<20231218165631.52731c83@lud1.home>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12990&group=comp.lang.tcl#12990

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: luc@sep.invalid (Luc)
Newsgroups: comp.lang.tcl
Subject: I find moving panedwindows very frustrating
Date: Mon, 18 Dec 2023 16:56:31 -0300
Organization: A noiseless patient Spider
Lines: 129
Message-ID: <20231218165631.52731c83@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Info: dont-email.me; posting-host="bbda96ec17d6c6ed006ece556aee8dab";
logging-data="3834726"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wCIj63Yi6Z/FZox6uoeP4AGyBVZTp3fo="
Cancel-Lock: sha1:ByBC++WdvFZKSKp/v22IiptPe10=
 by: Luc - Mon, 18 Dec 2023 19:56 UTC

I find moving panedwindows very frustrating.

My idea was to

1. drag sashes and save their positions so they could be re-applied
upon application restart

2. adjust column widths after they have been created, as needed.
For example, to adjust according to new content.

Mind you, the manual says this:

"Unlike slave windows managed by e.g. pack or grid, the panes
managed by a panedwindow do not change width or height to accomodate
changes in the requested widths or heights of the panes, once these
have become mapped."

I don't mind that they won't do that automatically. But they won't
let me do it programatically either.

Or will they?

First, something odd that I noticed. I am once again sharing some code
I shared yesterday:

-----------------------------
panedwindow $::Widgets_unipane.singleViewModeFileListPane -orient horizontal \
-background #FFFFFF -borderwidth 0 \
-cursor arrow -sashcursor sb_h_double_arrow -sashwidth 1 -showhandle 0 -sashrelief flat -handlepad 1
pack $::Widgets_unipane.singleViewModeFileListPane -fill both -expand 1

array set widths {filename 100 size 100 date 160 permission 120 owner 120}
set ::parent $::Widgets_unipane.singleViewModeFileListPane
foreach columnname $::CustomVars_FileListColumns {
set columnname [string tolower $columnname]
w.add frame [set columnname]frame "wi $widths($columnname) cu arrow fi both ex 1"
w.add button [set columnname]frame.button \
"tx [string totitle $columnname] fo {Arial 12} -bd 0 cu arrow \
bg #FFFFFF fg #BFBFBF highlightthickness 0 fi x ex 0 si top"
w.add text [set columnname]frame.box \
"fo {Arial 16} bg #FFFFFF fg #000000 bd 0 pd {0 0} sp1 1 sp2 1 sp3 1 \
wr none tf 0 es 1 un 0 st normal sg true cu arrow ys p.Utils.filelist.yset \
fi both ex 1 si left"

$::Widgets_unipane.singleViewModeFileListPane add $::Widgets_unipane.singleViewModeFileListPane.[set columnname]frame
$::Widgets_unipane.singleViewModeFileListPane.[set columnname]frame.box configure -relief flat -selectborderwidth 0 -insertborderwidth 0 -highlightthickness 1
$::Widgets_unipane.singleViewModeFileListPane paneconfigure $::Widgets_unipane.singleViewModeFileListPane.[set columnname]frame -stretch first -width $widths($columnname)
} -----------------------------

The odd thing is that I set the width of each column on two points of
the code with $widths($columnname). Either one alone won't do it. Both
are required. Which is weird. I wonder how much of that is by design.

Then I try to restore the widths after everything is already running.
For a simple test, an arbitrary number will do. So let it be 300:

$::Widgets_unipane.singleViewModeFileListPane.sizeframe configure -width 300
$::Widgets_unipane.singleViewModeFileListPane paneconfigure $::Widgets_unipane.singleViewModeFileListPane.sizeframe -stretch first -width 300

But that has absolutely no effect. Nothing happens.

Not being able to set an arbitrary width because the whole thing is
effectively frozen is frustrating enough. But it gets worse.

set ::FlowControl_DebugText [$::Widgets_unipane.singleViewModeFileListPane sash coord 0]

That gives me 100 0.

Now, what is 100 and what is 0? Relative to what? I don't see it in the
manual. Those can't be absolute coordinates.

Well, that column is indeed configured to be 100 pixels wide so maybe
that is that? So let's increase it to 200.

$::Widgets_unipane.singleViewModeFileListPane sash place 0 200 0

The column disappears. I think know why.
So let's try a much smaller number:

$::Widgets_unipane.singleViewModeFileListPane sash place 0 50 0

Ah, the sash has retreated (moved towards left).

Again:

$::Widgets_unipane.singleViewModeFileListPane sash place 0 10 0

It has retreated even more.

$::Widgets_unipane.singleViewModeFileListPane sash place 0 0 0

Now I expected the sash to retreat just a little bit more, but instead
of that the column to the left of "size" has disappeared completely
which is surprising because the disappearing column was really wide
(it was the first one so it had the "stretch" privilege) so there was
plenty, really plenty of room for the sash to retreat just a little
more and hit what I assumed would be "0".

Now I begin to see or assume that "0" is some kind of black hole
that will swallow widgets whole! Don't go near it!

Let's try another approach:

$::Widgets_unipane.singleViewModeFileListPane sash mark 0 100 0
$::Widgets_unipane.singleViewModeFileListPane sash dragto 0 10 0

Now the sash retreats quite a bit, so I guess it retreated 90 pixels
because 100 - 90 = 10. But I have to be very careful never to subtract
the whole mark index because of the black hole:

$::Widgets_unipane.singleViewModeFileListPane sash mark 0 100 0
$::Widgets_unipane.singleViewModeFileListPane sash dragto 0 0 0

Again, that causes the column to the left of the shash to disappear
completely.

So MAYBE I still can achieve my 2 original goals, but they (especially
goal #1) will require quite a bit of math and pitfall dodging.

Is it all really supposed to be that hard or am I doing something very
wrong again?

--
Luc
>>

Re: I find moving panedwindows very frustrating

<ulqcdg$3luk4$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=12991&group=comp.lang.tcl#12991

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wortkarg3@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: I find moving panedwindows very frustrating
Date: Mon, 18 Dec 2023 22:09:05 +0100
Organization: A noiseless patient Spider
Lines: 159
Message-ID: <ulqcdg$3luk4$1@dont-email.me>
References: <20231218165631.52731c83@lud1.home>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 18 Dec 2023 21:09:04 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8ea2e1a3a9905b33e1af3b58a80aed4b";
logging-data="3865220"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/kfRETH/KZvTpmIXagej/w"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:KSoUZ0IS0mPTr5SDccopR8ztvR4=
In-Reply-To: <20231218165631.52731c83@lud1.home>
Content-Language: en-GB
 by: Harald Oehlmann - Mon, 18 Dec 2023 21:09 UTC

Am 18.12.2023 um 20:56 schrieb Luc:
> I find moving panedwindows very frustrating.
>
> My idea was to
>
> 1. drag sashes and save their positions so they could be re-applied
> upon application restart
>
> 2. adjust column widths after they have been created, as needed.
> For example, to adjust according to new content.
>
> Mind you, the manual says this:
>
> "Unlike slave windows managed by e.g. pack or grid, the panes
> managed by a panedwindow do not change width or height to accomodate
> changes in the requested widths or heights of the panes, once these
> have become mapped."
>
> I don't mind that they won't do that automatically. But they won't
> let me do it programatically either.
>
> Or will they?
>
>
> First, something odd that I noticed. I am once again sharing some code
> I shared yesterday:
>
> -----------------------------
> panedwindow $::Widgets_unipane.singleViewModeFileListPane -orient horizontal \
> -background #FFFFFF -borderwidth 0 \
> -cursor arrow -sashcursor sb_h_double_arrow -sashwidth 1 -showhandle 0 -sashrelief flat -handlepad 1
> pack $::Widgets_unipane.singleViewModeFileListPane -fill both -expand 1
>
> array set widths {filename 100 size 100 date 160 permission 120 owner 120}
> set ::parent $::Widgets_unipane.singleViewModeFileListPane
> foreach columnname $::CustomVars_FileListColumns {
> set columnname [string tolower $columnname]
> w.add frame [set columnname]frame "wi $widths($columnname) cu arrow fi both ex 1"
> w.add button [set columnname]frame.button \
> "tx [string totitle $columnname] fo {Arial 12} -bd 0 cu arrow \
> bg #FFFFFF fg #BFBFBF highlightthickness 0 fi x ex 0 si top"
> w.add text [set columnname]frame.box \
> "fo {Arial 16} bg #FFFFFF fg #000000 bd 0 pd {0 0} sp1 1 sp2 1 sp3 1 \
> wr none tf 0 es 1 un 0 st normal sg true cu arrow ys p.Utils.filelist.yset \
> fi both ex 1 si left"
>
> $::Widgets_unipane.singleViewModeFileListPane add $::Widgets_unipane.singleViewModeFileListPane.[set columnname]frame
> $::Widgets_unipane.singleViewModeFileListPane.[set columnname]frame.box configure -relief flat -selectborderwidth 0 -insertborderwidth 0 -highlightthickness 1
> $::Widgets_unipane.singleViewModeFileListPane paneconfigure $::Widgets_unipane.singleViewModeFileListPane.[set columnname]frame -stretch first -width $widths($columnname)
> }
> -----------------------------
>
> The odd thing is that I set the width of each column on two points of
> the code with $widths($columnname). Either one alone won't do it. Both
> are required. Which is weird. I wonder how much of that is by design.
>
> Then I try to restore the widths after everything is already running.
> For a simple test, an arbitrary number will do. So let it be 300:
>
> $::Widgets_unipane.singleViewModeFileListPane.sizeframe configure -width 300
> $::Widgets_unipane.singleViewModeFileListPane paneconfigure $::Widgets_unipane.singleViewModeFileListPane.sizeframe -stretch first -width 300
>
> But that has absolutely no effect. Nothing happens.
>
> Not being able to set an arbitrary width because the whole thing is
> effectively frozen is frustrating enough. But it gets worse.
>
> set ::FlowControl_DebugText [$::Widgets_unipane.singleViewModeFileListPane sash coord 0]
>
> That gives me 100 0.
>
> Now, what is 100 and what is 0? Relative to what? I don't see it in the
> manual. Those can't be absolute coordinates.
>
> Well, that column is indeed configured to be 100 pixels wide so maybe
> that is that? So let's increase it to 200.
>
> $::Widgets_unipane.singleViewModeFileListPane sash place 0 200 0
>
> The column disappears. I think know why.
> So let's try a much smaller number:
>
> $::Widgets_unipane.singleViewModeFileListPane sash place 0 50 0
>
> Ah, the sash has retreated (moved towards left).
>
> Again:
>
> $::Widgets_unipane.singleViewModeFileListPane sash place 0 10 0
>
> It has retreated even more.
>
> $::Widgets_unipane.singleViewModeFileListPane sash place 0 0 0
>
> Now I expected the sash to retreat just a little bit more, but instead
> of that the column to the left of "size" has disappeared completely
> which is surprising because the disappearing column was really wide
> (it was the first one so it had the "stretch" privilege) so there was
> plenty, really plenty of room for the sash to retreat just a little
> more and hit what I assumed would be "0".
>
> Now I begin to see or assume that "0" is some kind of black hole
> that will swallow widgets whole! Don't go near it!
>
> Let's try another approach:
>
> $::Widgets_unipane.singleViewModeFileListPane sash mark 0 100 0
> $::Widgets_unipane.singleViewModeFileListPane sash dragto 0 10 0
>
> Now the sash retreats quite a bit, so I guess it retreated 90 pixels
> because 100 - 90 = 10. But I have to be very careful never to subtract
> the whole mark index because of the black hole:
>
> $::Widgets_unipane.singleViewModeFileListPane sash mark 0 100 0
> $::Widgets_unipane.singleViewModeFileListPane sash dragto 0 0 0
>
> Again, that causes the column to the left of the shash to disappear
> completely.
>
> So MAYBE I still can achieve my 2 original goals, but they (especially
> goal #1) will require quite a bit of math and pitfall dodging.
>
> Is it all really supposed to be that hard or am I doing something very
> wrong again?
>
>

Hi Luc,

here is my sequence to create a ttk::panedwindow with two saved sash
positions:

pack [set WiPath(WiPaned) [ttk::panedwindow $WiPath(FrTop).p\
-orient vertical]\
] -fill both -expand true -side top
# Add 3 Panes
foreach Index {1 2 3}\
Weight {0 0 1}\
{
set WiPath(FrP$Index) [ttk::frame $WiPath(WiPaned).p$Index]
$WiPath(WiPaned) add $WiPath(FrP$Index) -weight $Weight
}
# Init sash positions
foreach Sash {0 1} {
set Pos [lindex $State(SashPosY) $Sash]
if {[string is entier -strict $Pos]} {
$WiPath(WiPaned) sashpos $Sash $Pos
}
}

And here is how it is saved on program end:

foreach Sash {0 1} {
lappend State(SashPosY) [$WiPath(WiPaned) sashpos $Sash]
}

Hope this helps,
Harald

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor