Recent

Author Topic: [Solved] Scrollable, single line textbox - howto  (Read 173 times)

MathMan

  • Hero Member
  • *****
  • Posts: 518
[Solved] Scrollable, single line textbox - howto
« on: May 13, 2026, 10:49:36 am »
Hello all,

I admit I haven't worked with GUI applications so far (total noob on this topic). What I need is the following

- on a form I would like to have a single line textbox which is scrollable
- the textual content will be provided by the program and must not be editable by the user
- the text can become long (~1000 characters), therefore I would like to have a scrollbar for the textbox

What is a reasonable control for the textbox (there seems to be no direct fit in the available controls) and how do I associate the scrollbar to it?

MathMan
« Last Edit: May 13, 2026, 12:03:41 pm by MathMan »

cdbc

  • Hero Member
  • *****
  • Posts: 2818
    • http://www.cdbc.dk
Re: Scrollable, single line textbox - howto
« Reply #1 on: May 13, 2026, 11:46:34 am »
Hi
I'd use a TMemo and turn off 'WordWrap', turn on 'ssHorizontal' in Scrollbars and finally turn on 'ReadOnly'.
Have a 'LookSee' in the attachment  :D
Regards Benny
If it ain't broke, don't fix it ;)
PCLinuxOS(rolling release) 64bit -> KDE6/QT6 -> FPC Release -> Lazarus Release &  FPC Main -> Lazarus Main

MathMan

  • Hero Member
  • *****
  • Posts: 518
Re: Scrollable, single line textbox - howto
« Reply #2 on: May 13, 2026, 12:03:05 pm »
Many thanks Benny - that looks like what I need.

Regards,
MathMan

wp

  • Hero Member
  • *****
  • Posts: 13584
Re: Scrollable, single line textbox - howto
« Reply #3 on: May 13, 2026, 12:04:38 pm »
Drop a TScrollbox on the form, turn off its VertScrollbar (Visible = false). Drop a TLabel on the ScrollBox, move it to the top/left corner of the scrollbox. Assign the text to the Label.Caption. Set the ClientHeight of the scrollbar to the Height of the Label. Since the Label has AutoSize=true by default it will be a single-line textbox. And a Label cannot be edited.

MathMan

  • Hero Member
  • *****
  • Posts: 518
Re: [Solved] Scrollable, single line textbox - howto
« Reply #4 on: May 13, 2026, 01:00:08 pm »
Many thanks wp - I'll try that too. From your explanation it seems to be even closer to my requirements.

Regards,
MathMan

 

TinyPortal © 2005-2018