summaryrefslogtreecommitdiff
path: root/examples/apps/uidesigner/vfdeditors.pas
blob: c5ba41e147d96d4769a40a984642bc42c5cfce9c (plain)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
{
    fpGUI  -  Free Pascal GUI Toolkit

    Copyright (C) 2006 - 2008 See the file AUTHORS.txt, included in this
    distribution, for details of the copyright.

    See the file COPYING.modifiedLGPL, included in this distribution,
    for details about redistributing fpGUI.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    Description:
      Some property editors.
}

unit vfdeditors;

{$mode objfpc}{$H+}

interface

uses
  Classes,
  SysUtils,
  gfx_widget,
  gui_label,
  gui_button,
  gui_memo,
  vfdforms;

type

  TItemEditorForm = class(TVFDDialog)
  private
    procedure btnClearClicked(Sender: TObject);
    procedure OnButtonClick(Sender: TObject);
  public
    l1: TfpgLabel;
    edItems: TfpgMemo;
    btnOK: TfpgButton;
    btnCancel: TfpgButton;
    btnClear: TfpgButton;
    procedure AfterCreate; override;
  end;


implementation

uses
  fpgfx;

{ TItemEditorForm }

procedure TItemEditorForm.AfterCreate;
begin
  inherited;
  WindowTitle := 'Items';
  SetPosition(0, 0, 360, 230);

  l1 := CreateLabel(self, 8, 4, 'Items:');

  edItems := TfpgMemo.Create(self);
  with edItems do
  begin
    SetPosition(8, 24, 344, 168);
    Anchors := AllAnchors;
  end;

  btnClear := CreateButton(self, 8, 200, 80, 'Clear', @btnClearClicked);
  btnClear.Anchors := [anLeft, anBottom];

  btnOK         := CreateButton(self, btnClear.Right + 4, 200, 80, 'OK', @OnButtonClick);
  btnOK.Anchors := [anLeft, anBottom];

  btnCancel     := CreateButton(self, Width-84, 200, 80, 'Cancel', @OnButtonClick);
  btnCancel.Anchors := [anRight, anBottom];
  
end;

procedure TItemEditorForm.btnClearClicked(Sender: TObject);
begin
  edItems.Lines.Clear;
end;

procedure TItemEditorForm.OnButtonClick(Sender: TObject);
begin
  if Sender = btnOK then
    ModalResult := 1
  else
    ModalResult := 2;
end;


end.