Advertisement
vmuller

Build C++ GUI apps FAST! Your first C++ GUI app!

Aug 8th, 2022
1,159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1. //---------------------------------------------------------------------------
  2.  
  3. #include <fmx.h>
  4. #pragma hdrstop
  5.  
  6. #include "Unit1.h"
  7. //---------------------------------------------------------------------------
  8. #pragma package(smart_init)
  9. #pragma resource "*.fmx"
  10. TForm1 *Form1;
  11. //---------------------------------------------------------------------------
  12. __fastcall TForm1::TForm1(TComponent* Owner)
  13.     : TForm(Owner)
  14. {
  15. }
  16. //---------------------------------------------------------------------------
  17. void __fastcall TForm1::AddButtonClick(TObject *Sender)
  18. {
  19.     String taskText = TaskEdit->Text;
  20.     TasksListBox->Items->Add(taskText);
  21.     TaskEdit->Text="";
  22.     AddButton->Enabled=false;
  23.     TaskEdit->SetFocus();
  24. }
  25. //---------------------------------------------------------------------------
  26. void __fastcall TForm1::TasksListBoxItemClick(TCustomListBox * const Sender, TListBoxItem * const Item)
  27.  
  28. {
  29.     int index = Item->Index;
  30.     TasksListBox->Items->Delete(index);
  31.     TaskEdit->SetFocus();
  32. }
  33. //---------------------------------------------------------------------------
  34.  
  35. void __fastcall TForm1::TaskEditKeyUp(TObject *Sender, WORD &Key, System::WideChar &KeyChar,
  36.           TShiftState Shift)
  37. {
  38.     String taskText = TaskEdit->Text;
  39.     if (taskText!="") {
  40.         AddButton->Enabled=true;
  41.     }
  42.     else
  43.     {
  44.         AddButton->Enabled=false;
  45.     }
  46. }
  47. //---------------------------------------------------------------------------
  48.  
  49.  
  50. void __fastcall TForm1::FormCreate(TObject *Sender)
  51. {
  52.     AddButton->Enabled=false;
  53.     TaskEdit->SetFocus();
  54. }
  55. //---------------------------------------------------------------------------
  56.  
  57.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement