On 18/07/13 12:54, Koenraad Lelong wrote:
For a touchscreen-application  (so no real keyboard) I need something
like a memo.
I first tried a memo, but how do I enter text at the caret ? And the
caretpos is readonly.
Next I tried synMemo, but if I move the caret, the caret disappears. How
can I show it ?
How do I send a BackSpace, Delete ?
How do I hide the "rightedge" of the synMemo ? Just set it to the
backgroundcolor ?

Is there a better component ?

TMemo should work - just use SelStart instead of CaretPos.

Try the code below to get you started: Form with a Memo and 2 buttons, named LetterAButton and DeleteButton.

Regards,

Malcolm

//============================================================

procedure TForm1.LetterAButtonClick ( Sender: TObject ) ;
var
  testcaretpos: Integer;
begin
  testcaretpos := Memo1.SelStart;
  Memo1.Text := Copy(Memo1.Text, 1, testcaretpos) + 'A'
        + Copy(Memo1.Text, testcaretpos+1, MaxInt);
  Inc(testcaretpos);
  Memo1.SelStart := testcaretpos;
  Memo1.SetFocus;
end;

procedure TForm1.DeleteButtonClick ( Sender: TObject ) ;
var
  testcaretpos: Integer;
begin
  testcaretpos := Memo1.SelStart;
  Memo1.Text := Copy(Memo1.Text, 1, testcaretpos)
        + Copy(Memo1.Text, testcaretpos+2, MaxInt);
  Memo1.SelStart := testcaretpos;
  Memo1.SetFocus;
end;



--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to