Recent

Author Topic: Problem with vertical label  (Read 15105 times)

madepabloh

  • Full Member
  • ***
  • Posts: 160
Problem with vertical label
« on: August 15, 2011, 12:36:03 am »
I try to use a label component to show a text, but in vertical position. I change the font orientation value from 0 to 900, but text seems to disappear from the component.

I tried to solve using not autosize, to change the alignment, font quality, and some other options without a good end.

Any idea about what i am doing wrong to have a text on vertical position?

Thanks!

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Problem with vertical label
« Reply #1 on: August 15, 2011, 12:57:03 am »
I just tried.
I changed Autosize to False and I manually changed Height (and Width).
But if someone will have different font, it may cause problem. If the font will be little bigger then it can be cutted.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

madepabloh

  • Full Member
  • ***
  • Posts: 160
Re: Problem with vertical label
« Reply #2 on: August 15, 2011, 01:20:47 am »
Thanks Blaazen,

However, it does not work for me. I have it in Autozise:=False, and height and width in 300 for a caption text := 'Label' (i mean, enough big in size to show the text), and it is still empty...

Edited:

I think it is a problem of the coordinates of the component and the rotation... the coordinate origin of the label is located in the upper-left corner. So, when the text turns, at 90º, it is out of the rectangle  of the component. I don´t know if i explained it corrctly, but if you try with different values between 0 and 900, you will see what i mean.

So, it seems to be a problem on the own component...
« Last Edit: August 15, 2011, 01:25:32 am by madepabloh »

Eclipticon

  • Jr. Member
  • **
  • Posts: 51
Re: Problem with vertical label
« Reply #3 on: August 15, 2011, 01:25:47 am »
On a Windows system, I have tried the same as you, Blaazen. With increasingly big values for Orientation, one can see that the Text rotates to outside the manually defined box, no matter how big it is ...
Lazarus 1.2.4 on Win XP/7 Virtual Machine

madepabloh

  • Full Member
  • ***
  • Posts: 160
Re: Problem with vertical label
« Reply #4 on: August 15, 2011, 01:35:56 am »
That is Eclipticon!

Well explained!!

typo

  • Hero Member
  • *****
  • Posts: 3051
Re: Problem with vertical label
« Reply #5 on: August 15, 2011, 01:47:41 am »
Try the BugTracker.

madepabloh

  • Full Member
  • ***
  • Posts: 160
Re: Problem with vertical label
« Reply #6 on: August 15, 2011, 01:58:23 am »
OK Typo,

I tried and someone else already writed about it few days ago:
http://62.166.198.202/view.php?id=19471

So, it seems to be a bug and we should wait to future updates of lazarus.

Cheers,

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: Problem with vertical label
« Reply #7 on: August 15, 2011, 08:09:18 am »
madepabloh,

If I really had to have that, and nothing else worked, as discussed, I would simply use one label for each letter, and place the labels in a column.

I think there are also ways to line or conform them one to each other, if necessary, and even group them.

Then, I'd use a monospaced font.

With this 'method' you could even have each letter have a different color and font variations!
« Last Edit: August 15, 2011, 01:36:49 pm by Elmug »

Scoops

  • Full Member
  • ***
  • Posts: 103
Re: Problem with vertical label
« Reply #8 on: August 15, 2011, 09:01:19 am »
Try:

Code: [Select]
Label1.Caption:= 'V'+#10+'E'+#10+'R'+#10+'T'+#10+'I'+#10+'C'+#10+'A'+#10+'L';

Is That What you are trying to do ?

Elmug

  • Hero Member
  • *****
  • Posts: 849
Re: Problem with vertical label
« Reply #9 on: August 15, 2011, 01:35:02 pm »
I try to use a label component to show a text, but in vertical position. I change the font orientation value from 0 to 900, but text seems to disappear from the component.

I tried to solve using not autosize, to change the alignment, font quality, and some other options without a good end.

Any idea about what i am doing wrong to have a text on vertical position?

Thanks!

madepabloh,

You can also go to the TLabel's property Caption, Click on the [...] and enter your legend when the editing window opens.

Then, each letter you terminate it with the Enter key, and the label will show the letters typed in a column.

Arbee

  • Full Member
  • ***
  • Posts: 223
Re: Problem with vertical label
« Reply #10 on: August 15, 2011, 05:30:32 pm »
The only one that comes close is by using a TStaticText (with Center or Right Alignment) and then rotate the text the other way around.  so -900.

It does mean of course you have to accept the fact that the text runs from top to bottom.
1.0/2.6.0  XP SP3 & OS X 10.6.8

Blaazen

  • Hero Member
  • *****
  • Posts: 3241
  • POKE 54296,15
    • Eye-Candy Controls
Re: Problem with vertical label
« Reply #11 on: August 15, 2011, 05:53:52 pm »
I cannot rotate TStaticText on Linux+Qt4.
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

madepabloh

  • Full Member
  • ***
  • Posts: 160
Re: Problem with vertical label
« Reply #12 on: August 16, 2011, 09:20:48 am »
Thanks for your ideas!

I do not want a text on a colum, but a rotated word. However, i will try this solution on the mean time.

Thanks so much!

Arbee

  • Full Member
  • ***
  • Posts: 223
Re: Problem with vertical label
« Reply #13 on: August 16, 2011, 09:50:52 am »
@Blaazen
Indeed looks like it works on Windows only.  Just tried it on my Mac and that doesn't work either.
1.0/2.6.0  XP SP3 & OS X 10.6.8

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Problem with vertical label
« Reply #14 on: August 16, 2011, 10:49:50 am »
Why not just draw the label in the OnPaint event of the window?

procedure TMyForm.OnPaint(...);
begin
  Canvas.Font.Orientation := 900;
  Canvas.TextOut(some parameters here);
end;

TLabel was not designed to support the orientation change, but then, the standard components are only that: standard. People can easily achieve any custom behavior with the OnPaint event or with a custom drawn component.

 

TinyPortal © 2005-2018