showinfou.pas

来自「source for card readers」· PAS 代码 · 共 55 行

PAS
55
字号
unit ShowInfoU;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics,
  Controls, Forms, Dialogs, TemplateU, StdCtrls, Buttons, ExtCtrls,
  SightingU;

type
  TfrmShowInfo = class(TfrmTemplate)
    lblPrompt: TLabel;
    lblGrid: TLabel;
    lblNumber: TLabel;
    lblSightType: TLabel;
    lblDate: TLabel;
    lblBreeding: TLabel;
  public
    procedure ShowInfo (ASighting: TSighting); // receive reference to Sighting
  end; // end TfrmShowInfo = class(TfrmTemplate)

var
  frmShowInfo: TfrmShowInfo;

implementation

{$R *.dfm}

procedure TfrmShowInfo.ShowInfo(ASighting: TSighting);
begin
  // first display substitutable properties
  lblGrid.Caption := 'Grid: ' + ASighting.Grid;
  lblNumber.Caption := 'Number: ' + IntToStr(ASighting.Number);
  lblSightType.Caption := 'Type: ' + ASighting.SightType;

  // now display child-specific properties
  if ASighting is TBirdSighting then
    with (ASighting as TBirdSighting) do
    begin
      lblDate.Caption := 'Date: ' + SightDate;
      lblDate.Visible := True;
      lblBreeding.Caption := 'Breeding: ' +
                             BoolToStr(Breeding, True);
      lblBreeding.Visible := True;
    end
  else if ASighting is TTreeSighting then
  begin  
    lblDate.Visible := False;
    lblBreeding.Visible := False;
  end;
  ShowModal;
end; // end procedure TfrmShowInfo.ShowInfo

end. // end ShowInfoU

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?