/main.pas

http://github.com/fpierin/exemplo_absolute_delphi · Pascal · 54 lines · 43 code · 10 blank · 1 comment · 5 complexity · 3eae5846b8b49380720e76193618add3 MD5 · raw file

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