fork download
  1. //---------------------------------------------------------------------------
  2.  
  3. #ifndef Unit1H
  4. #define Unit1H
  5. //---------------------------------------------------------------------------
  6. #include <System.Classes.hpp>
  7. #include <Vcl.Controls.hpp>
  8. #include <Vcl.StdCtrls.hpp>
  9. #include <Vcl.Forms.hpp>
  10. //---------------------------------------------------------------------------
  11. class TForm1 : public TForm
  12. {
  13. __published: //
  14. TMemo *Memo1;
  15. TButton *Button1;
  16. void __fastcall Memo1KeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
  17. private: //
  18. int m_lineNo;
  19. public: //
  20. __fastcall TForm1(TComponent* Owner);
  21. };
  22. //---------------------------------------------------------------------------
  23. extern PACKAGE TForm1 *Form1;
  24. //---------------------------------------------------------------------------
  25. #endif
  26.  
  27.  
  28.  
  29.  
  30. //---------------------------------------------------------------------------
  31.  
  32. #include <vcl.h>
  33. #pragma hdrstop
  34.  
  35. #include "Unit1.h"
  36. #include "Unit2.h"
  37. //---------------------------------------------------------------------------
  38. #pragma package(smart_init)
  39. #pragma resource "*.dfm"
  40. TForm1 *Form1;
  41. //---------------------------------------------------------------------------
  42. __fastcall TForm1::TForm1(TComponent* Owner)
  43. : TForm(Owner)
  44. {
  45. m_lineNo = 0;
  46. Memo1->Clear();
  47. }
  48. //---------------------------------------------------------------------------
  49.  
  50. // http://stackoverflow.com/questions/14189171/removing-last-blank-line-in-memo/14189378#14189378
  51.  
  52. void __fastcall TForm1::Memo1KeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
  53.  
  54. {
  55. if (Key == VK_F9) {
  56. String str = String().sprintf(L"%03d: ", m_lineNo);
  57.  
  58. // Memo1->Lines->Add(str);
  59. // instead, use follow
  60. Memo1->SelStart = Memo1->GetTextLen();
  61. Memo1->SelLength = 0;
  62. Memo1->SelText = str;
  63.  
  64. m_lineNo++;
  65. }
  66. }
  67. //---------------------------------------------------------------------------
  68.  
  69.  
  70.  
  71.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:6:30: fatal error: System.Classes.hpp: No such file or directory
 #include <System.Classes.hpp>
                              ^
compilation terminated.
stdout
Standard output is empty