PageRenderTime 17ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/main.pas

http://github.com/fpierin/exemplo_absolute_delphi
Pascal | 54 lines | 43 code | 10 blank | 1 comment | 5 complexity | 3eae5846b8b49380720e76193618add3 MD5 | raw file
 1unit main;
 2
 3interface
 4
 5uses
 6  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
 7  Dialogs, StdCtrls;
 8
 9type
10  TForm1 = class(TForm)
11    Edit1: TEdit;
12    Memo1: TMemo;
13    ComboBox1: TComboBox;
14    procedure FormCreate(Sender: TObject);
15  private
16    procedure TornarTextoDoObjetoEmMaiusculas(Sender: TObject);
17  end;
18
19var
20  Form1: TForm1;
21
22implementation
23
24{$R *.dfm}
25
26procedure TForm1.TornarTextoDoObjetoEmMaiusculas(Sender: TObject);
27var
28  Edit    : TEdit     absolute Sender;
29  Memo    : TMemo     absolute Sender;
30  ComboBox: TComboBox absolute Sender;
31begin
32  if (Sender is TEdit) then
33  begin
34    Edit.Text := UpperCase(Edit.Text);
35  end
36  else if (Sender is TMemo) then
37  begin
38    Memo.Text := UpperCase(Memo.Text);
39  end
40  else if (Sender is TComboBox) and (ComboBox.Style = csDropDown) then
41  begin
42    ComboBox.Text := UpperCase(ComboBox.Text);
43  end;
44end;
45
46procedure TForm1.FormCreate(Sender: TObject);
47begin
48  Self.Edit1.OnChange     := TornaTextoEmMaiusculas;
49  Self.ComboBox1.OnChange := TornaTextoEmMaiusculas;
50  Self.Memo1.OnChange     := TornaTextoEmMaiusculas;
51end;
52
53end.
54