Project Multi-Device Application (FireMonkey, not VCL). Target Win32.

On the form is a Memo and a button. By clicking on the button, the text from Memo is taken, processed and displayed back. After that, the text cursor in the Memo becomes invisible.

How to make the cursor not disappear?

The minimum reproducible example is:

pas

procedure TForm1.Button1Click(Sender: TObject); begin Memo1.Lines.Text := Memo1.Lines.Text; end; 

fmx

  object Memo1: TMemo Touch.InteractiveGestures = [Pan, LongTap, DoubleTap] DataDetectorTypes = [] Align = Bottom ControlType = Platform Position.Y = 40.000000000000000000 Size.Width = 640.000000000000000000 Size.Height = 440.000000000000000000 Size.PlatformDefault = False TabOrder = 0 Viewport.Width = 636.000000000000000000 Viewport.Height = 436.000000000000000000 end 

UPD

If the form loses focus and then gets back, then the cursor returns until the next programmatic change of the Lines property.

    1 answer 1

    Try using the TMemo.CaretPosition property to set the cursor to the position you want (specifying the line number and symbol number).

    In addition, in order for the cursor to be visible, the Memo component must be in focus.

    • Did not help. Judging by how Memo responds to pressing the buttons of the keyboard and mouse clicks - the cursor is, moves, but simply is not displayed. - German Borisov
    • Memo.Caret.Visible := True; (as an option, False first, then True)? ... And, by the way, Memo.Lines.Clear in the code above is superfluous, since destination .Text replaces all text. - Alekcvp
    • Focus with Memo.Caret.Visible too, did not pass. About Clear - I agree. He stayed from the original project, where the record was on the means of the set call Add . Corrected in the question. - German Borisov