Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //---------------------------------------------------------------------------
- #include <fmx.h>
- #pragma hdrstop
- #include "Unit1.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.fmx"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::AddButtonClick(TObject *Sender)
- {
- String taskText = TaskEdit->Text;
- TasksListBox->Items->Add(taskText);
- TaskEdit->Text="";
- AddButton->Enabled=false;
- TaskEdit->SetFocus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::TasksListBoxItemClick(TCustomListBox * const Sender, TListBoxItem * const Item)
- {
- int index = Item->Index;
- TasksListBox->Items->Delete(index);
- TaskEdit->SetFocus();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::TaskEditKeyUp(TObject *Sender, WORD &Key, System::WideChar &KeyChar,
- TShiftState Shift)
- {
- String taskText = TaskEdit->Text;
- if (taskText!="") {
- AddButton->Enabled=true;
- }
- else
- {
- AddButton->Enabled=false;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- AddButton->Enabled=false;
- TaskEdit->SetFocus();
- }
- //---------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement