summaryrefslogtreecommitdiffstats
path: root/PerlTQt/tutorials/t7/LCDRange.pm
blob: 33883e6c721c295b8a6dbcf05643c8cd0d7e56d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package LCDRange;
use strict;
use TQt;
use TQt::isa qw(TQt::VBox);
use TQt::slots setValue => ['int'];
use TQt::signals valueChanged => ['int'];
use TQt::attributes qw(slider);

sub NEW {
    shift->SUPER::NEW(@_);

    my $lcd = TQt::LCDNumber(2, this, "lcd");

    my $slider = TQt::Slider(&Horizontal, this, "slider");
    slider = $slider;
    slider->setRange(0, 99);
    slider->setValue(0);
    $lcd->connect(slider, TQ_SIGNAL('valueChanged(int)'), TQ_SLOT('display(int)'));
    this->connect(slider, TQ_SIGNAL('valueChanged(int)'), TQ_SIGNAL('valueChanged(int)'));
}

sub value { slider->value }

sub setValue {
    my $value = shift;
    slider->setValue($value);
}

1;