home *** CD-ROM | disk | FTP | other *** search
- //---------------------------------------------------------------------------
- #include <vcl\vcl.h>
- #pragma hdrstop
-
- #include "rchmov1.h"
- #include "logwarn.h"
- #include "math.h"
- //---------------------------------------------------------------------------
- #pragma link "RChart"
- #pragma resource "*.dfm"
- TForm1 *Form1;
- bool RunMove;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ButDoneClick(TObject *Sender)
- {
- Close();
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ButStartClick(TObject *Sender)
- {
- const int NPnts = 140;
-
- int i,j;
-
- ButStop->Enabled = true;
- ButStart->Enabled = false;
- ButDone->Enabled = false;
- RChart1->RangeLoX = 0;
- RChart1->RangeHiX = NPnts;
- RChart1->RangeLoY = 10;
- RChart1->RangeHiY = 600;
- RChart1->DataColor = clBlack;
- RChart1->ClearGraf();
- for (i=1; i<=NPnts; i++)
- RChart1->MarkAt (i, NPnts+i*sin(i*0.1), 0);
- RChart1->ShowGraf();
- RunMove = true;
- RChart1->DataColor = clBlue;
- RChart1->MarkAt (0,0,12);
- RChart1->DataColor = clRed;
- RChart1->MarkAt (0,0,12);
- RChart1->ShowGraf();
- i = 0;
- j = 0;
- while (RunMove == true)
- {
- j = j+2;
- if (j > NPnts)
- {
- j = 1;
- }
- i++;
- if (i > NPnts)
- {
- i = 1;
- }
- RChart1->RemoveLastItem();
- RChart1->RemoveLastItem();
- RChart1->DataColor = clRed;
- RChart1->MarkAt (i,NPnts+i*sin(i*0.1), 18);
- RChart1->DataColor = clBlue;
- RChart1->MarkAt (j,NPnts+j*sin(j*0.1), 18);
- RChart1->ShowGraf();
- Application->ProcessMessages();
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ButStopClick(TObject *Sender)
- {
- ButStop->Enabled = false;
- ButStart->Enabled = true;
- ButDone->Enabled = true;
- RunMove = False;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::CBLogXClick(TObject *Sender)
- {
- if ((! CBLogX->Checked) && (RChart1->RangeLoX <= 0))
- {
- LogWarnForm->ShowModal();
- CBLogX->Checked = false;
- }
- else
- {
- RChart1->LogScaleX = CBLogX->Checked;
- CBLogX->Checked = RChart1->LogScaleX;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::CBLogYClick(TObject *Sender)
- {
- if ((! CBLogY->Checked) && (RChart1->RangeLoY <= 0))
- {
- LogWarnForm->ShowModal();
- CBLogY->Checked = false;
- }
- else
- {
- RChart1->LogScaleY = CBLogY->Checked;
- CBLogY->Checked = RChart1->LogScaleY;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormMouseMove(TObject *Sender, TShiftState Shift, int X,
- int Y)
- {
- Screen->Cursor = crDefault;
- }
- //---------------------------------------------------------------------------