Forum > Beginners

Cursor position in TMemo like "gotoxy"

<< < (2/2)

bobby100:
TMemo.Lines.Add will always add the line at the end of the text.
You need to access the TMemo.Text and edit it as a string.
You can access the lines with TMemo.Lines[i: integer], but the line must be created before you can access it.

pascal111:

--- Quote from: paweld on June 28, 2022, 11:08:46 am ---the coordinate you want to set must exist

--- End quote ---

I was avoiding that!

Edson:

--- Quote from: pascal111 on June 28, 2022, 04:34:53 pm ---
--- Quote from: paweld on June 28, 2022, 11:08:46 am ---the coordinate you want to set must exist

--- End quote ---
I was avoiding that!

--- End quote ---

Maybe you don't need TMemo. It's an oriented-line control like any Edition control. Even TSynEdit works that way.

If you want to locate text in any arbitrary position you can use a char matrix like a Terminal screen or DOS screen. I have simulated a Terminal screens using TSynEdit but it need to be carefully programated.

A Stringgrid must do the trick but it's a table control and behave like that.

Other option is to draw directly the text in the Canvas or using some graphic library. If you need to edit the text it's more complicated. You could manage dynamically TEdit controls.

winni:

--- Quote from: pascal111 on June 28, 2022, 04:34:53 pm ---
--- Quote from: paweld on June 28, 2022, 11:08:46 am ---the coordinate you want to set must exist

--- End quote ---

I was avoiding that!

--- End quote ---


Hi!

Ugly workaround:

Initialize the memo with the needed amount of strings filled with spaces (#32)
Then set your Memo in the overwrite mode.

Now you got what you need.

Don't tell anybody that you got this trick from me.

Winni

pascal111:

--- Quote from: winni on June 28, 2022, 06:18:16 pm ---
--- Quote from: pascal111 on June 28, 2022, 04:34:53 pm ---
--- Quote from: paweld on June 28, 2022, 11:08:46 am ---the coordinate you want to set must exist

--- End quote ---

I was avoiding that!

--- End quote ---


Hi!

Ugly workaround:

Initialize the memo with the needed amount of strings filled with spaces (#32)
Then set your Memo in the overwrite mode.

Now you got what you need.

Don't tell anybody that you got this trick from me.

Winni

--- End quote ---

I have no choice other of this trick for that other solutions cost much.

Navigation

[0] Message Index

[*] Previous page

Go to full version