File: dlgform.pas

package info (click to toggle)
lazarus 4.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 276,392 kB
  • sloc: pascal: 2,344,754; xml: 509,184; makefile: 355,815; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (77 lines) | stat: -rw-r--r-- 1,508 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
unit DlgForm;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;

type
  
  { TForm1 }

  TForm1 = class(TForm)
    dirButton: TButton;
    colorButton: TButton;
    fontButton: TButton;
    saveButton: TButton;
    openButton: TButton;
    closeButton: TButton;
    dirLabel: TLabel;
    fileLabel: TLabel;
    procedure ButtonClick(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.ButtonClick(Sender: TObject);
begin
  case TButton(Sender).Tag of
    1 : Close;
    2 : with TOpenDialog.Create(Self) do
        begin
          Filter := '*.pp';
          Options := Options + [ofAllowMultiSelect];
          if Execute then fileLabel.Caption := FileName;
          Free;
        end;
    3 : with TSaveDialog.Create(Self) do
        begin
          Filename := 'untitled.pp';
          if Execute then fileLabel.Caption := FileName;
          Free;
        end;
    4 : with TFontDialog.Create(Self) do
        begin
          Font.Assign(fontButton.Font);
          if Execute then fontButton.Font.Assign(Font);
          Free;
        end;
    5 : with TColorDialog.Create(Self) do
        begin
          Color := Self.Color;
          if Execute then Self.Color := Color;
          Free;
        end;
    6 : with TSelectDirectoryDialog.Create(Self) do
        begin
          if Execute then dirLabel.Caption := FileName;
          Free;
        end;
  end;
end;

end.