I have submitted a follow-up a bug report whose text I reproduce below.
http://sourceforge.net/tracker/index.php?func=detail&aid=1092732&group_id=16572&atid=116572

Regards,
Rob.

This example shows a problem with

Win32::GUI::Slider/Trackbar::Pos() method.  It creates 3
sliders,
and attempts to set them to their center point in 3
different ways
- Pos(50)
- SetPos(50)
- Pos(50,1)
The first method does not re-draw the slider in the new position
until the control is selected (click near the bottom right
of the
select area), although it's stored position is correct (can be
confirmed with GetPos()). This appears to be because when
called with one parameter the re-draw flag in the SendMessage
call is set incorrectly: forcing the redraw flag to 1 with
Pos(50,1)
solves the problem, as does using SetPos(50) which correctly
defaults its re-draw flag to 1.

Workaround:
(1) Use the 2-parameter version of Pos, forcing the redraw
flag to 1.
(2) Use SetPos method

I think (but have not tried) that the
Solution is to correct line 642 of trackbar.xs from
RETVAL = SendMessage(handle, TBM_SETPOS, 0, (LPARAM)
SvIV(ST(1)))
to
RETVAL = SendMessage(handle, TBM_SETPOS, 1, (LPARAM)
SvIV(ST(1)))

This 'bug' also appears in Min() (line 603) and Max() (line
623),
although in those functions it has no obvious visual impact.

use strict;
use warnings;

use Win32::GUI 1.0;

my $mw = new Win32::GUI::Window (
        -size => [200,200],
);

my $s1 = $mw->AddSlider (
        -width => $mw->ScaleHeight(),
        -height => 30,
);
$s1->Pos(50);

my $s2 = $mw->AddSlider (
        -width => $mw->ScaleHeight(),
        -height => 30,
        -top => $s1->Top() + $s1->Height(),
);
$s2->SetPos(50);

my $s3 = $mw->AddSlider (
        -width => $mw->ScaleHeight(),
        -height => 30,
        -top => $s2->Top() + $s2->Height(),
);
$s3->Pos(50,1);

print "1: ".$s1->GetPos()."\n";
print "2: ".$s2->GetPos()."\n";
print "3: ".$s3->GetPos()."\n";

$mw->Show();
Win32::GUI::Dialog();



Reply via email to