Extended or New TurboVision Objects


Q. 402 How can I create a password inputline?
Easiest is to create TPassWordInputLine, a descendent of TInputLine which overrides the Draw method. Example TPasswordInputLine:
     type
       PPasswordInputLine = ^TPasswordInputLine;
       TPasswordInputLine = object(TInputLine)
         procedure Draw;  virtual;
       end;

     procedure TPasswordInputLine.Draw;
     var
       s : string;
       i : integer;
     begin
       s := Data^;
       for i := 1 to length(s) do  Data^[i] := '*';
       inherited Draw;
       Data^ := s;
     end;
Next question
B de Boer Last modified: Tuesday 18 April 1995 - 10:20