How to display two digits as an lcd

Posted by Jenny on March 13, 2005

In Reply to: How to display two digits as an lcd posted by Thomo on March 12, 2005

: how to display any two digits between 00..99 as a lcd.
: using seven polygons for each digit that lights up when a number is clicked. These digits should be painted on Tcanvas at run time. should have an on and an off button to control the display and buttons in the range 0..9

You could use 7 TShape components for the segments of an LCD's digit, TS1 through TS7. When you show the digit, first make them all invisible:

   TS1.Hide;
   TS2.Hide;
   ...
   TS3.Hide; 

Second, make some segments visible, depending of the value of the digit, with a CASE construction:

case Digit of
  1: begin
      TS3.Show;
      TS6.Show;
     end;
  2: begin
      TS1.Show;
      TS4.Show;
      TS5.Show;
      TS7.Show;
    end;
  // ...and so on

The same technique for the other digit, but use TS8 to TS14.