Posted by hallinl on September 09, 2005
In Reply to: Re: Deleting Letters in a Delphi Memo posted by Madboy
on July 11, 2005
: My only idea would to be store each letter as a variable. Then
you could use something VK_Keypress_BKSPACE or something. Im not sure exactly how
to do it, but maybe this could give someone more experience a lead on how to do it.
Its nearly there i think :)
Not having ever dealt with memo fields, I'd try:
If ... then
Delete(memo2.text,Length(memo2.text),1);
That should delete the last character in memo2.text.
Correction by the DelphiLand Team:
That won't work, because you can't pass
a property of an object (memo2.text) as a "var" parameter
of a routine.
But you can use
Delphi's Copy function instead of Delete:
Memo1.Text := Copy(Memo1.Text, 1, Length(Memo1.Text) - 1);
Or if you insist ;) on using Delete, firstly put the Memo's text-property into
a string variable, next delete the last character of that string, next put the string
again in the Memo's text, like this:
var
S: string;
begin
...
S := Memo1.Text;
Delete(S, Length(S), 1);
Memo1.Text := S;
|