Re: odd behaviour of Scale widget

[email protected]
Newsgroups gmane.comp.lang.perl.tk
Message-ID <OF2C9E8F6E.26AF4636-ONC1256F8F.0025426F-41256F8F.00263CE1@philips.com>
Hi Vadim,

yes, sorry, that one slipped through - another copy-and-past error :-((
So at least configuring the tickinterval doesn't change the resolution.

My intention was not to compare Tcl / Perl Tk behaviour but
to point out  that the Scale widget has problems when
configured to resolutions other then 1 when the 'from' value is
not on the same resolution grid with the origin at 0.

So it's not possible to set -resolution => 3, -from => 1 for instance.
-from can only be 0, 3, 6... in this case!

I included the Tcl code because as far as I know the Perl/Tk
code is derived from the Tcl/Tk code.

Regards,
Gerhard




|---------+---------------------------->
|         |                            |
|         |                            |
|         |                            |
|         |                            |
|         |                            |
|         |    konovalo                |
|         |    <[email protected]|
|         |    >                       |
|         |                            |
|         |    Sent by:                |
|         |    [email protected]|
|         |    .EDU                    |
|         |                            |
|         |    2005-01-19 06:20 PM     |
|         |                            |
|---------+---------------------------->
  >---------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                           |
  |           To:   Gerhard Petrowitsch/STN/SC/PHILIPS@PHILIPS                                                                |
  |           cc:   [email protected]                                                                                    |
  |           Subject:    Re: odd behaviour of Scale widget                                                                   |
  |                                                                                                                           |
  |           Classification:                                                                                                 |
  |                                                                                                                           |
  |                                                                                                                           |
  >---------------------------------------------------------------------------------------------------------------------------|





>I'm using a Scale widget in my application. Some of it's features
>can be configured during runtime (-from, -to, -resolution, -tickinterval).
>
>I noticed, that the Scale widget is buggy or at least odd behaving
>during this reconfigurations sometimes.
>
>For more see the little test script attached:
>(See attached file: testScale.pl)
>It creates 4 Scales. The topmost can be configured with the
>other 3 Scales. You can try a lot of things there yourself, but
>
>

I noticed your perlTk code different from Tcl code, for example

$mw->Label(-text => "configure 'tickinterval' of SUT:")->pack(-anchor =>
'w');
my $tick = $mw->Scale(-from => 0, -to => 20, -resolution => 1,
-tickinterval => 1,
                      -orient => 'horizontal', -width => 8, -length =>
300, -sliderlength => 16,
                      -variable => \$tickVal,
                      -command => sub{$scale->configure(-resolution =>
$tickVal)})->pack();

you promise configuring tickinterval but instead configure resolution;
-to values are also not consistent.

However, if you have both Tcl/Tk and perlTk of same code, I strongly
advice looking  into Tcl::Tk perl module from CPAN.
Tcl::Tk able to run pure-Tcl code at one side, and , from another side,
your perlTk version will work from within Tcl::Tk when you will replace
"use Tk;" line with "use Tcl::Tk qw(:perlTk);"
So it will be easier for you to compare behaviours.

Tcl::Tk translates your perlTk code into Tcl/Tk widget directives, and
final GUI processor will be Tcl/Tk
I often uses both approaches from within same script, and find this
quite convenient.
Note, though, that currently CVS version of Tcl::Tk module contains more
complete documentation, compared to current CPAN version.

Best regards,
Vadim..




-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]



-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.