Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2013-09

WordWrap in TLabel

10 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Jürgen Hestermann

Does anybody know where the routine resides that actually does the splitting into lines of TLabel.Caption (if WordWrap is true)? I don't like it's behaviour and want to change (overwrite) it.

Currently, long lines are not wrapped when no spaces exist. I am wondering why this is the case because the reason for wrap is, that the whole text should be visible all the time. And that's not the case now.

Reply by email

Bart
to Jürgen Hestermann
J?rgen Hestermann wrote
Does anybody know where the routine resides that actually does the splitting into lines of TLabel.Caption (if WordWrap is true)? I don't like it's behaviour and want to change (overwrite) it.

Probably done by the widgetset.

Bart

Reply by email

Junior
to Bart

In Object Inspector:
AutoSize = False
WordWrap = True

With the mouse, expand more the Label component to the desired point.

Bart wrote 15 lines
On 9/14/13, J?rgen Hestermann wrote: > Does anybody know where the routine resides that actually > does the splitting into lines of TLabel.Caption (if WordWrap is true)? > I don't like it's behaviour and want to change (overwrite) it. Probably done by the widgetset. Bart -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply by email

Jürgen Hestermann
to Junior
Junior wrote 6 lines
In Object Inspector: AutoSize = False WordWrap = True With the mouse, expand more the Label component to the desired point.

???
I am not able to change the size of the label at runtime with the mouse. And even if this would work I would not like it as I want it to be done *automatically* (as it does when spaces exist).

Reply by email

Jürgen Hestermann
to Bart: Probably done by the widgetset. Bart
Bart wrote 6 lines
On 9/14/13, J?rgen Hestermann wrote: > Does anybody know where the routine resides that actually > does the splitting into lines of TLabel.Caption (if WordWrap is true)? > I don't like it's behaviour and want to change (overwrite) it. Probably done by the widgetset.

I fear that it's like that.
Too bad that programmers have less and less
of their programs under their control.

Reply by email

Martin
to Jürgen Hestermann
J?rgen Hestermann wrote 13 lines
Am 2013-09-14 15:09, schrieb Bart: > On 9/14/13, J?rgen Hestermann wrote: > >> Does anybody know where the routine resides that actually >> does the splitting into lines of TLabel.Caption (if WordWrap is true)? >> I don't like it's behaviour and want to change (overwrite) it. > Probably done by the widgetset. I fear that it's like that. Too bad that programmers have less and less of their programs under their control.

See

function TCustomLabel.CalcFittingFontHeight(const TheText: string;
   MaxWidth, MaxHeight: Integer;
   var FontHeight, NeededWidth, NeededHeight: integer): Boolean;

A flag is given to DrawText

You can look up DrawText in each widgetset, it may exist with and without themes...
Best to hit it in the debugger, and see where it goes.

---
What exactly do you want to change?

IMHO it works very well, even with auto-sizing, BUT you need to anchor left and right to other controls

Reply by email

Jürgen Hestermann
to Martin
Martin wrote 7 lines
See function TCustomLabel.CalcFittingFontHeight(const TheText: string; MaxWidth, MaxHeight: Integer; var FontHeight, NeededWidth, NeededHeight: integer): Boolean; A flag is given to DrawText You can look up DrawText in each widgetset, it may exist with and without themes... Best to hit it in the debugger, and see where it goes.

I already stepped through everything with the debugger but couldn't see how and where the text is splitted into lines.

What exactly do you want to change? IMHO it works very well, even with auto-sizing, BUT you need to anchor left and right to other controls

If the text contains no spaces it is not want to change this and split the text in all situations (independend from the content of the text).

Reply by email

Martin
to Jürgen Hestermann
J?rgen Hestermann wrote 12 lines
Am 2013-09-14 16:19, schrieb Martin: > See > function TCustomLabel.CalcFittingFontHeight(const TheText: string; > MaxWidth, MaxHeight: Integer; > var FontHeight, NeededWidth, NeededHeight: integer): Boolean; > A flag is given to DrawText > You can look up DrawText in each widgetset, it may exist with and > without themes... > Best to hit it in the debugger, and see where it goes. I already stepped through everything with the debugger but couldn't see how and where the text is splitted into lines.

Possible tat on some OS, it si done by the OS itself.

IIRC on gtk, there is something in the WS. But others I do not know.

Show quoted text 7 lines
> What exactly do you want to change? > IMHO it works very well, even with auto-sizing, BUT you need to > anchor left and right to other controls If the text contains no spaces it is not wrapped at all. I want to change this and split the text in all situations (independend from the content of the text).

Ah. No Idea.

Reply by email

Mattias Gaertner
to Martin
Show quoted text 5 lines
On 14/09/2013 15:37, J?rgen Hestermann wrote: [...] > If the text contains no spaces it is not wrapped at all. > I want to change this and split the text in all > situations (independend from the content of the text).

If you need it cross platform then you have to implement your own TLabel descendant and do the drawing and size calculation yourself. Or patch TLabel. It's open source.

Mattias

Reply by email

Graeme Geldenhuys
to Jürgen Hestermann: I fear that it's like that. Too bad that programmers have less and less of their programs…
J?rgen Hestermann wrote
Too bad that programmers have less and less of their programs under their control.

Hence the reason I have always been pro about fully custom implemented toolkits. The developer then has FULL control over the look, feel and behaviour of the toolkit.

Regards,
- Graeme -

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/

Reply by email