You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
992 B
44 lines
992 B
13 years ago
|
package LCDRange;
|
||
|
use strict;
|
||
13 years ago
|
use TQt;
|
||
|
use TQt::isa qw(TQt::VBox);
|
||
|
use TQt::slots
|
||
13 years ago
|
setValue => ['int'],
|
||
|
setRange => ['int', 'int'];
|
||
13 years ago
|
use TQt::signals
|
||
13 years ago
|
valueChanged => ['int'];
|
||
13 years ago
|
use TQt::attributes qw(
|
||
13 years ago
|
slider
|
||
|
);
|
||
|
|
||
|
sub NEW {
|
||
|
shift->SUPER::NEW(@_);
|
||
|
|
||
13 years ago
|
my $lcd = TQt::LCDNumber(2, this, "lcd");
|
||
13 years ago
|
|
||
13 years ago
|
slider = TQt::Slider(&Horizontal, this, "slider");
|
||
13 years ago
|
slider->setRange(0, 99);
|
||
|
slider->setValue(0);
|
||
13 years ago
|
$lcd->connect(slider, TQT_SIGNAL('valueChanged(int)'), TQT_SLOT('display(int)'));
|
||
|
this->connect(slider, TQT_SIGNAL('valueChanged(int)'), TQT_SIGNAL('valueChanged(int)'));
|
||
13 years ago
|
|
||
|
setFocusProxy(slider);
|
||
|
}
|
||
|
|
||
|
sub value { slider->value }
|
||
|
|
||
|
sub setValue { slider->setValue(shift) }
|
||
|
|
||
|
sub setRange {
|
||
|
my($minVal, $maxVal) = @_;
|
||
|
if($minVal < 0 || $maxVal > 99 || $minVal > $maxVal) {
|
||
|
warn "LCDRange::setRange($minVal,$maxVal)\n" .
|
||
|
"\tRange must be 0..99\n" .
|
||
|
"\tand minVal must not be greater than maxVal\n";
|
||
|
return;
|
||
|
}
|
||
|
slider->setRange($minVal, $maxVal);
|
||
|
}
|
||
|
|
||
|
1;
|