Page 1 of 2

CreateTextObject using Align

Posted: Wed Jul 19, 2023 2:24 pm
by Juan Carlos
I found this problem with the instruction CreateTextObject always it create the text object with the left align; I tryed to use with center and right but always the text object is showed to left by default, where is the problem, in below easy example, is visible this problem:

Code: Select all

;Always CreateTextObject uses Align=#LEFT
CreateTextObject(1, "DINERO")
CreateTextObject(2, "Perico 1000", {Align=#LEFT})
CreateTextObject(3, "Perico 30", {Align=#RIGHT})
CreateTextObject(4, "Perico 9", {Align=#CENTER})

DisplayTextObjectFX(1, 300, 10, {Type=#ZOOMCENTER, Speed=10}) 
DisplayTextObjectFX(2, 280, 30, {Type=#ZOOMCENTER, Speed=5})
DisplayTextObjectFX(3, 280, 50, {Type=#ZOOMCENTER, Speed=5})
DisplayTextObjectFX(4, 280, 70, {Type=#ZOOMCENTER, Speed=5})

EscapeQuit(False)
Repeat
  WaitEvent
Forever
Thanks for suggestions ideas, etc,

Re: CreateTextObject using Align

Posted: Wed Jul 19, 2023 3:35 pm
by Flinx
I am not completely sure, but I think this Align argument only works for multiple lines inside one text object. The x position of the Text is determined by DisplayTextObject().

Code: Select all

CreateTextObject(1, "DINERO")
CreateTextObject(2, "Perico 1000\nPerico 30\nPerico 9", {Align=#JUSTIFIED})

DisplayTextObjectFX(1, 300, 10, {Type=#ZOOMCENTER, Speed=10}) 
DisplayTextObjectFX(2, 280, 30, {Type=#ZOOMCENTER, Speed=5})

Re: CreateTextObject using Align

Posted: Wed Jul 19, 2023 5:27 pm
by Juan Carlos
Flinx wrote: Wed Jul 19, 2023 3:35 pm I am not completely sure, but I think this Align argument only works for multiple lines inside one text object. The x position of the Text is determined by DisplayTextObject().

Code: Select all

CreateTextObject(1, "DINERO")
CreateTextObject(2, "Perico 1000\nPerico 30\nPerico 9", {Align=#JUSTIFIED})

DisplayTextObjectFX(1, 300, 10, {Type=#ZOOMCENTER, Speed=10}) 
DisplayTextObjectFX(2, 280, 30, {Type=#ZOOMCENTER, Speed=5})
The useful is the other for example to show a hall of fame, your solution will be good for simple text, not for text changing.

Re: CreateTextObject using Align

Posted: Wed Jul 19, 2023 8:10 pm
by Flinx
This was no solution, it should show you how it works and why you get always left aligned text. And that it is no Hollywood bug.
If you would change something, maybe you should activate layers. With layer objects you are free to modify, get the size and adjust the position in the way you want.

Re: CreateTextObject using Align

Posted: Wed Jul 19, 2023 11:17 pm
by airsoftsoftwair
Flinx wrote: Wed Jul 19, 2023 8:10 pm And that it is no Hollywood bug.
+1

Re: CreateTextObject using Align

Posted: Thu Jul 20, 2023 9:23 am
by Juan Carlos
Flinx wrote: Wed Jul 19, 2023 8:10 pm This was no solution, it should show you how it works and why you get always left aligned text. And that it is no Hollywood bug.
If you would change something, maybe you should activate layers. With layer objects you are free to modify, get the size and adjust the position in the way you want.
Error, I use layers this time and the result is that align left for the text lines instead of align right.

Re: CreateTextObject using Align

Posted: Thu Jul 20, 2023 9:24 am
by Juan Carlos
airsoftsoftwair wrote: Wed Jul 19, 2023 11:17 pm
Flinx wrote: Wed Jul 19, 2023 8:10 pm And that it is no Hollywood bug.
+1
Good help when you launch the next Hollywood version I shall pay it with this answer too.

Re: CreateTextObject using Align

Posted: Thu Jul 20, 2023 10:36 am
by Juan Carlos
A point, the Layes are not the magic solution to problems, in fact, sometimes they cause more problems than benefits, an example is the drop in performance on computers due to their use, you can draw a black circle with Layes and even in a PC is slow, you do the same without using it, and it's fast.

Re: CreateTextObject using Align

Posted: Thu Jul 20, 2023 10:40 am
by Juan Carlos
airsoftsoftwair wrote: Wed Jul 19, 2023 11:17 pm
Flinx wrote: Wed Jul 19, 2023 8:10 pm And that it is no Hollywood bug.
+1
I know that you don't like being taken out of Hollywood's miseries and you only like to be praised, and provide doubts and suggestions from people like me, they've been bothering you for years, you only like people who praise you, which I I see it as detrimental, an example with Hollywood 4.8 I got to notify you of a bug with the sound, and this was not corrected until version 7 or 8, I think I remember, because one of your praisers rediscovered it, I think because I added some suggestion of mine like WaitMusicEnd() is not to show that you respect me as a Hollywood user, just to show that you listen, pure and simple marketing.
Now +2

Re: CreateTextObject using Align

Posted: Thu Jul 20, 2023 11:01 am
by Flinx
Juan Carlos wrote: Thu Jul 20, 2023 9:23 am Error, I use layers this time and the result is that align left for the text lines instead of align right.
If you use the same code you get the same results of course. But then you have layer objects. You can query their horizontal size and change the position to align it in the way you want.
You really should try to understand how things work instead of expecting some magic. Look at your code. You set the x position of your lines with DisplayTextObjectFX(). So this left position is determined.
---
Now I just read your last answer. If I had done this sooner, I wouldn't be trying to help anymore. But here's an approach you can go on with.
But we can't keep doing the work for you and listen to unkind replies for it.

Code: Select all

EnableLayers()

TextOut(0, 10, "DINERO", {Name="DINERO"})
TextOut(0, 30, "Perico 1000", {Name="P1000", Hidden=True})
TextOut(0, 50, "Perico 30", {Name="P30", Hidden=True})

xpos=300
w=GetAttribute(#LAYER, "DINERO", #ATTRWIDTH)
SetLayerStyle("DINERO", {X=xpos-w})
w=GetAttribute(#LAYER, "P1000", #ATTRWIDTH)
SetLayerStyle("P1000", {X=xpos-w})
w=GetAttribute(#LAYER, "P30", #ATTRWIDTH)
SetLayerStyle("P30", {X=xpos-w})

ShowLayerFX("P1000",{Type=#ZOOMCENTER})
ShowLayerFX("P30",{Type=#ZOOMCENTER})