home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 March / Chip_1999-03_cd.bin / zkuste / delphi / D / MATEM.ARJ / RCHART.ZIP / exmpl-6 / cpp3 / fifomain.cpp next >
Encoding:
C/C++ Source or Header  |  1997-05-23  |  2.1 KB  |  66 lines

  1. //---------------------------------------------------------------------------
  2. #include <vcl\vcl.h>
  3. #pragma hdrstop
  4.  
  5. #include "fifomain.h"
  6. #include "math.h"
  7. //---------------------------------------------------------------------------
  8. #pragma link "RChart"
  9. #pragma resource "*.dfm"
  10. TForm1 *Form1;
  11. bool   EndProg;
  12. double DataCnt;
  13. //---------------------------------------------------------------------------
  14. __fastcall TForm1::TForm1(TComponent* Owner)
  15.     : TForm(Owner)
  16. {
  17. }
  18. //---------------------------------------------------------------------------
  19. void __fastcall TForm1::BButExitClick(TObject *Sender)
  20. {
  21. Close();    
  22. }
  23. //---------------------------------------------------------------------------
  24. void __fastcall TForm1::BButStartClick(TObject *Sender)
  25. {
  26. const double Step = 1.0;
  27.  
  28. BButExit->Enabled = false;
  29. BButStart->Enabled = false;
  30. BButStop->Enabled = true;
  31. EndProg = false;
  32. while (! EndProg)
  33.   {
  34.   Application->ProcessMessages();
  35.   DataCnt = DataCnt + Step;
  36.   RChart1->DataColor = clBlue;
  37.   RChart1->MarkAt (DataCnt, sin(0.19*DataCnt)*cos(0.02*DataCnt), 10);
  38.   RChart1->DataColor = clRed;
  39.   RChart1->MoveTo (DataCnt-1, cos(0.09*(DataCnt-1)));
  40.   RChart1->DrawTo (DataCnt, cos(0.09*DataCnt));
  41.   if (DataCnt > 80)
  42.     {
  43.     RChart1->RemoveFirstItem();                 // remove MarkAt }
  44.     RChart1->RemoveFirstItem();                 // remove MoveTo }
  45.     RChart1->RemoveFirstItem();                 // remove DarwTo }
  46.     RChart1->SetRange (RChart1->RangeLoX+Step, RChart1->RangeLoY,
  47.                       RChart1->RangeHiX+Step, RChart1->RangeHiY);
  48.     }
  49.   RChart1->ShowGraf();
  50.   }
  51. }
  52. //---------------------------------------------------------------------------
  53. void __fastcall TForm1::BButStopClick(TObject *Sender)
  54. {
  55. EndProg = true;
  56. BButExit->Enabled = true;
  57. BButStart->Enabled = true;
  58. BButStop->Enabled = false;
  59. }
  60. //---------------------------------------------------------------------------
  61. void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X,
  62.     int Y)
  63. {
  64. Screen->Cursor = crDefault;
  65. }
  66. //---------------------------------------------------------------------------