Changeset 95 for trunk/UControls.pas


Ignore:
Timestamp:
Sep 28, 2022, 12:23:17 AM (20 months ago)
Author:
chronos
Message:
  • Added: Show dialog about new train every start of new week.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UControls.pas

    r86 r95  
    1818    Bounds: TRect;
    1919    Canvas: TCanvas;
     20    procedure MouseUp(Position: TPoint);
    2021    constructor Create; virtual;
    2122    procedure Paint; virtual;
    2223    property Enabled: Boolean read FEnabled write SetEnabled;
    2324    property OnClick: TNotifyEvent read FOnClick write FOnClick;
     25  end;
     26
     27  { TLabel }
     28
     29  TLabel = class(TControl)
     30    Text: string;
     31    procedure Paint; override;
    2432  end;
    2533
     
    4452implementation
    4553
     54{ TLabel }
     55
     56procedure TLabel.Paint;
     57begin
     58  if Assigned(Canvas) then
     59  with Canvas do begin
     60    TextOut(Bounds.Left, Bounds.Top, Text);
     61  end;
     62end;
     63
    4664{ TButton }
    4765
     
    5876  FEnabled := AValue;
    5977  if Assigned(Canvas) then Paint;
     78end;
     79
     80procedure TControl.MouseUp(Position: TPoint);
     81begin
     82  if Bounds.Contains(Position) then
     83  if Assigned(FOnClick) then FOnClick(Self);
    6084end;
    6185
Note: See TracChangeset for help on using the changeset viewer.