Board index » cppbuilder » delete method seems not to work properly ...

delete method seems not to work properly ...

void __fastcall TForm1::Timer2Timer(TObject *Sender)
{
  if((x < strlen(asshat)) && orentation == 1)
    Form1->Caption = Form1->Caption + asshat[x++];
  else if((x < strlen(asshat) + 1) && !orentation)
    {
    Form1->Caption.Delete(Form1->Caption.Length(),1);
    x--;
    }
  else
   {
   orentation = !orentation;
   }

Quote
}

that peice of code _SHOULD_ make an effect on the form's caption bar, by
spelling out the letters one by one,
and then deleting them so on and so fourth... but for some reason the
'delete' method does nothing .. no matter what
i put in there ( EVEN CONSTANT VALUES! )

thanks for the help!

 

Re:delete method seems not to work properly ...


Zer0for0ejkee,

That's a known issue related to the fact that Caption is a property
(there's a function call you can't see) and you are actually
modifying a temporary variable.

You need to use your own temporary AnsiString eg:

    {
      AnsiString tmp=Form1->Caption;
      tmp.Delete(tmp.Length(),1);
      Form1->Caption=tmp;
      x--;
    }

--
Andrue Cope
[Bicester, UK]

Team Thai Kingdom

Other Threads