Hi Gerhard,
Am 14.11.12 23:27, schrieb Gerhard Reithofer:
> On Mon, 12 Nov 2012, Christian Gollwitzer wrote:
>> Then your program design is seriously broken. Are the pack/grid commands for
>> one master scattered through all the source code? As you mention megawidgets,
>> any reasonable megawidget framework does NOT grid/pack the topmost frame
>> itself, but simply returns it to the caller. If you have functions like this
>
> I'm just using an existing extension (from an external user) which is in
> productive use for many years - why is MY design broken?
>
Sorry, I didn't want to offend you. All I'm saying is that a design,
where you have pack/grid invocations for the same master in different
places is broken, as it can go wrong easily. After all, that's what is
causing you trouble.
Using pack and grid in the same master has always been an error, even if
it seemingly works in 8.5 (with the exception of pack propagate 0).
That's the same thing like "undefined behaviour" in C - it can work, but
will probably break when the implementation changes. For instance, this
pack/grid thing behaved differently in 8.5 between Win,X11 and OSX.
>
>>> Some companies have several 100 scripts which must be ported.
>>> At least I know a few departments which stopped testing 8.6 because of
>>> that incalculable fact. Many programs run without problems for years,
>>> but not with 8.6.
>>
> More clearly:
> I'm talking about code written in a period of time of over 10 years, by
> different programmers, some of them are not present anymore. Some of the
> scripts are mission critical, they are used on several 100 workstations.
>
> I'm NOT talking about code that is written now!
>
> Open questions are:
> # Which one of "these scripts have been broken before"?
All that use pack and grid in the same master.
> # How many will have to be ported?
All of them from #1, except if you simply stick to 8.5
> # How much time/money will it cost?
I have no insight into the codebase. That question can only be
answered/estimated with a serious look at the code.
> # How secure will the porting be?
In what sense "secure"? Do you mean that it doesn't break again? That
depends on the fix: If using Uwe's workaround, it is very fragile. If
redesignig in a way that all geometry operations are in one place, it
should be pretty safe.
> # How many "bugs" (you call "broken") will be missed?
??? You will always have more bugs than you can think of. There is only
very few masterpieces of software which is provably free of bugs. The
question you ask is provable unanswerable, since it reduces to the
halting problem.
> the pack/grid
> lines have been located in different code parts, partially in other
> files.
Well THAT is the design issue I'm talking about. As you mention BWidget,
have you seen Emilianos reply?
Quoting from:
http://wiki.tcl.tk/9924
package require BWidget
# Make a text-widget scrollable
set sw [ScrolledWindow .sw]
pack $sw -fill both -expand true
set txt [text $sw.txt -wrap none]
$sw setwidget $txt
Here, it would be an error to do
pack $txt
as you can't know how this is managed inside ScrolledWindow. Therefore,
there is the "setwidget" method which knows how to do it correctly. The
same thing applies, for instance, for ScrolledFrame - it has a
"getframe" method which gives you the place where you can freely
pack/place/grid.
Another example would be procedures that construct wigets *and*
pack/grid them. This is a bad idea, the solution would be to return the
widgets exactly like real Tk widgets (and megawidget frameworks) do it.
Then, all grid/pack commands for the same master are in one place and
it's evident what to use.
>
> The real problem is the large code base.
It boils down to either
A) live with the bug and stick to 8.5
B) Use ugly fragile workarounds if you desperately need some new 8.6
feature and live with a break in the future
C) Fix the buggy scripts
Christian