Hiya, I'm trying to get some code to work...I am tryna get a shape to roll from left to right. So far i have written this code and my shape does go from left to right but does not roll. It is part of a GUI when i press the button it moves 2 to the right then stops. I find myslef having to press the button continously to make it roll. But what i want is to press the button once and make the shape roll from left to right and stop at position 300. Any suggestions on where im going wrong on my code? thanks
//---------------------------------------------------------------------------
void __fastcall TForm1::TimerTimer(TObject *Sender)
{
Timer->Enabled= false;
int TotalShapeAmount;
int ShapeAmount;
TotalShapeAmount = 0;
ShapeAmount = 2;
if(Shape->Left<=300)
{
TotalShapeAmount = Shape->Left+ShapeAmount;
Shape->Left=TotalShapeAmount;
}
}}
//---------------------------------------------------------------------------
void __fastcall TForm1::ButtonClick(TObject *Sender)
{
Timer->Enabled = true;
}
//---------------------------------------------------------------------------