NAME

TUI::Gadgets::CalcDisplay - display view of the calculator gadget

HIERARCHY

TObject
  TView
    TCalcDisplay

SYNOPSIS

use TUI::Objects;
use TUI::Gadgets;

my $display = TCalcDisplay->new(
  bounds => TRect->new( ax => 3, ay => 2, bx => 21, by => 3 ),
);
$dialog->insert( $display );

DESCRIPTION

TCalcDisplay is the display of the TCalculator gadget. It shows the number currently entered or calculated, right-aligned, with a sign column in front of it.

The view accepts keyboard input and the cmCalcButton broadcasts of the calculator buttons. It understands the digits, the decimal point, backspace (BS and ESC), the sign toggle (_ and +/- character), the operators + - * / %, = and Enter, and C to clear the display. Division by zero shows Error until the next C.

Results are formatted like the C++ ostream output of a double, that is with six significant digits.

CONSTRUCTOR

new

my $display = TCalcDisplay->new( bounds => $bounds );

Creates a new display showing 0. The view is selectable and receives keyboard and broadcast events.

new_TCalcDisplay

my $display = new_TCalcDisplay( $bounds );

Factory-style constructor using a positional bounds argument.

METHODS

draw

$display->draw();

Draws the sign and the number right-aligned in the view.

getPalette

my $palette = $display->getPalette();

Returns the palette of the view.

handleEvent

$display->handleEvent( $event );

Processes keyboard events and cmCalcButton broadcasts.

SEE ALSO

TCalculator, TView

AUTHORS

  • Borland International (original Turbo Vision design)

  • J. Schneider <brickpool@cpan.org> (Perl implementation and maintenance)

COPYRIGHT AND LICENSE

Copyright (c) 1990-1994, 1997 by Borland International

Copyright (c) 2026 the "AUTHORS" as listed above.

This software is licensed under the MIT license (see the LICENSE file, which is part of the distribution).