//---------------------------------------------------------------------------
#include <vcl\vcl.h>
#pragma hdrstop

#include "Demo6Frm.h"
//---------------------------------------------------------------------------
#pragma link "RichView"
#pragma link "RVScroll"
#pragma link "RVStyle"
#pragma resource "*.dfm"
TfrmDemo6 *frmDemo6;
//---------------------------------------------------------------------------
__fastcall TfrmDemo6::TfrmDemo6(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TfrmDemo6::FormCreate(TObject *Sender)
{
  ImageIndex = 0;
  Red  = 150;
  DRed = 5;
  rvs->TextStyles->Items[rvsHeading]->Color = (TColor)RGB(Red,0,0);
  // How many items the following statements adds? (adding string with 10 "\r\n"?)
  // Answer: 11! because it is considered like
  // ""+"\r\n"+""+"\r\n"+""+"\r\n"+""+"\r\n"+""+"\r\n"+""+"\r\n"+""+"\r\n"+""+
  // +"\r\n"+""+"\r\n"+""+"\r\n"+""
  rv->AddTextNL("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", 0,0,0);
  // And since v1.1 you can use TopMargin and BottomMargin properties instead of
  // adding empty lines!
  rv->AddBulletEx("",0,il,1);
  rv->Add("Credits Demo", 1);
  rv->AddTextNL(
        "Roberto Nelson\r\n"
        "Bruce Young\r\n"
        "Kim Lambert\r\n"
        "Leslie Johnson\r\n"
        "Phil Forest\r\n"
        "K.J. Weston\r\n"
        "Lee Terry\r\n"
        "Stewart Hall\r\n"
        "Katherine Young\r\n"
        "Chris Papadopulos\r\n"
        "Pete Fisher\r\n"
        "Ann Bennet\r\n"
        "Roger De Sousa\r\n"
        "Janet Boldwin\r\n"
        "Roger Reeves\r\n"
        "Willie Stansbury\r\n"
        "Leslie Phong\r\n"
        "Ashok Ramanathan",0,0,0);
  rv->AddNL("and other people from Employee.db",2,0);
  rv->AddTextNL("\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n", 0,0,0);
  rv->VSmallStep = 1;
  rv->Format();
}
//---------------------------------------------------------------------------
void __fastcall TfrmDemo6::tmrTimer(TObject *Sender)
{
   if (rv->VScrollPos!=rv->VScrollMax)
     rv->VScrollPos = rv->VScrollPos+1;
   else
     rv->VScrollPos = 0;
   Red += DRed;
   rvs->TextStyles->Items[rvsHeading]->Color = (TColor)RGB(Red,0,0);
   if (Red==255 || Red==100)
     DRed = (char)-DRed;
   if (++ImageIndex == il->Count)
     ImageIndex = 0;
   rv->SetBulletInfo(11,"",ImageIndex,NULL,0);
}
//---------------------------------------------------------------------------