Hi,
Yes, that's very close to what I want. I don't need the dropdown part just
a standard, one-line Text box, but except for that, it's exactly what I'd
like.
See the example below - much of the code was cut & pasted from one of my
apps, so it's not as clear as it could/should be, but it should help.
Cheers,
jez.
-------------
use Win32::GUI;
use strict;
my $buddyValue;
my $win;
Init();
$win->Show();
Win32::GUI::Dialog();
sub Init {
#create the window
$win
=Win32::GUI::DialogBox->new('-maximizebox','0','-controlparent','0','-width','253','-helpbox','0','-menubox','1','-name','Buddy','-topmost','0','-resizable','0','-left','291','-text','Buddy','-top','257','-minimizebox','0','-height','162',@_);
#add a text field and an updown control
$win->AddTextfield('-width','84','-name','Price','-tabstop','1','-left','68','-visible','1','-top','24','-height','20','-addstyle','2','-tip','New
Price');
$win->AddUpDown(
-name => 'UD',
-base => 10,
-onScroll => sub {BuddyScroll($_[3])},
-autobuddy => 0,
-arrowkeys => 1,
-setbuddy => 0,
-tip => 'Change price by one decimal place',
);
#make the updown control a buddy of the text field
$win->UD->SetBuddy($win->Price);
#set a big range for the buddy
$buddyValue=2500;
$win->UD->Range(1,5000);
$win->UD->Pos(2500);
return $win;
}
sub BuddyScroll {
#Move the value up/down by X decimal places
my ($pos)[EMAIL PROTECTED];
my ($control,$value);
my $control=$win->Price;
$value=$buddyValue;
my $val=$control->Text;
my $dp=2; #X
my $point=10;
$point **= $dp;
$point=1/$point;
if ($value>$pos) {
$val-=$point;
}
elsif ($value<$pos) {
$val+=$point;
}
$control->Text($val) if $val>0;
$buddyValue = $pos;
}