The workaround is to call the Win32::GUI::SendMessage function instead of
the Pos function.
If you call the Pos funtion first it seems to disable future calls...
<code>
#!perl
use Win32::GUI;
$Window = new GUI::Window(
-title => "Win32::GUI::Slider test",
-left => 100,
-top => 100,
-width => 300,
-height => 100,
-name => "Window",
);
$Window->AddSlider(
-left => 10,
-top => 10,
-height => 150,
-width => 150,
-name => "Slider",
);
$Window->Slider->Min(0);
$Window->Slider->Max(10);
my $pos=3;
my $hwnd=$Window->Slider->{-handle};
print "$hwnd\n";
#$Window->Slider->Pos(3);
#Win32::GUI::SendMessage works as long as you do not call the Pos function
before
Win32::GUI::SendMessage($hwnd, 1029, 1,$pos);
$Window->Show;
Win32::GUI::Dialog();
sub Window_Terminate {
return -1;
}
</code>
----- Original Message -----
From: "Glenn Linderman" <[EMAIL PROTECTED]>
To: "Steven Lloyd" <[EMAIL PROTECTED]>
Cc: <perl-win32-gui-users@lists.sourceforge.net>
Sent: Wednesday, December 29, 2004 11:35 PM
Subject: Re: [perl-win32-gui-users] Slider Position
Hmm. Yes, this is very interesting. Any mouse clicks in the region of
the slider (even if not on the active area), cause the slider to jump
immediately to the expected initial position. So it is not like the code
has no effect, but it does not have the desired visual effect, until other
interaction happens.
It is almost like some default redraw operation got stuck or ignored, or
didn't get generated.
Well, I can confirm it is an inappropriate behavior. I'd suggest that you
submit a bug report for it on Sourceforge. I don't have time to
investigate it further at present. Maybe someone else will... the bug
will ensure that we don't lose track of the issue.
On approximately 12/29/2004 10:00 PM, came the following characters from
the keyboard of Steven Lloyd:
The following code demonstrates the slider problem - pos does not seem to
set the position anymore
---------------------------------------------------------------------------------------
#!perl
use Win32::GUI;
$Window = new GUI::Window(
-title => "Win32::GUI::Slider test",
-left => 100,
-top => 100,
-width => 300,
-height => 100,
-name => "Window",
);
$Window->AddSlider(
-left => 10,
-top => 10,
-height => 150,
-width => 150,
-name => "Slider",
);
$Window->Slider->Min(0);
$Window->Slider->Max(10);
#The following line should set the slider position to the 3rd tick from
the left but it does not.
$Window->Slider->Pos(3);
$Window->Show;
Win32::GUI::Dialog();
sub Window_Terminate {
return -1;
}
---------------------------------------------------------------------------------------
----- Original Message ----- From: "Glenn Linderman" <[EMAIL PROTECTED]>
To: "Steven Lloyd" <[EMAIL PROTECTED]>
Cc: <perl-win32-gui-users@lists.sourceforge.net>
Sent: Wednesday, December 29, 2004 1:08 PM
Subject: Re: [perl-win32-gui-users] Slider Position
On approximately 12/29/2004 7:40 AM, came the following characters from
the keyboard of Steven Lloyd:
looks like setting a slider position using $Window->Slider->Pos(4) no
longer works in version 1.0.
Any workarounds?
Not something I've used... can you make a short script demonstrating the
problem for testing/investigation?
--
Glenn -- http://nevcal.com/
===========================
Having identified a vast realm of ignorance, Wolfram is saying that much
of this realm lies forever outside the light cone of human knowledge.
-- Michael Swaine, Dr Dobbs Journal, Sept 2002
-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
--
Glenn -- http://nevcal.com/
===========================
Having identified a vast realm of ignorance, Wolfram is saying that much
of this realm lies forever outside the light cone of human knowledge.
-- Michael Swaine, Dr Dobbs Journal, Sept 2002