This repository was archived by the owner on Dec 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.cpp
More file actions
53 lines (46 loc) · 1.58 KB
/
input.cpp
File metadata and controls
53 lines (46 loc) · 1.58 KB
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
//---------------------------------------------------------------------------
#include <fmx.h>
#pragma hdrstop
#include "input.h"
#include "message.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.fmx"
//---------------------------------------------------------------------------
__fastcall TInputForm::TInputForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TInputForm::OkButtonClick(TObject *Sender)
{
OkButton->ModalResult = mrNone;
if ( NameEdit->Text.Trim().IsEmpty() )
{
ErrorMessage( L"This field cannot be empty" );
return;
}
OkButton->ModalResult = mrOk;
}
//---------------------------------------------------------------------------
void __fastcall TInputForm::CancelButtonClick(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TInputForm::FormShow(TObject *Sender)
{
NameEdit->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TInputForm::NameEditKeyDown(TObject *Sender, WORD &Key, System::WideChar &KeyChar,
TShiftState Shift)
{
if( Key == VK_RETURN ) OkButton->SetFocus();
}
//---------------------------------------------------------------------------
void __fastcall TInputForm::NameEditChangeTracking(TObject *Sender)
{
OkButton->Enabled = ( !NameEdit->Text.IsEmpty() );
}
//---------------------------------------------------------------------------