Page 1 of 1

TextOut command and text Justify

Posted: Mon Aug 26, 2024 5:49 am
by SpawnPPC
Hi everyone.

I have these 2 lines of code:

-----
TextOut(#CENTER, WinHeight/4, GetCatalogString(16, "Critical Error!")) ; Display a blank line and then string 5 with the solution, with English fallback
-----
TextOut(#CENTER, WinHeight/4 + 40, GetCatalogString(5, "Error: The executable must be run from the AmiWORP-Gate directory.\n\nTo solve this issue, ensure that the executable is located in the correct folder.\nIf the executable is not inside the AmiWORP-Gate folder, the application will not function correctly and will continue to show this error.\n\nThe program will close in:"))
-----

There are 2 TextOut commands.
I'm going crazy trying to figure out why the first command works fine and places itself perfectly in the center of the window I have open, while the second is all wrong and seems to start further to the left of the window, practically outside the window and therefore missing pieces, like if the #CENTRE command doesn't work.

Ideas ?

Also is there a way to justify the text ?

Thanks everyone

bySpawnPPC

Re: TextOut command and text Justify

Posted: Mon Aug 26, 2024 6:32 am
by plouf
how certain you are that catalogstring id =16 is NOT a "" (correctly loaded but empty string ?)

more code needed, just a small sniped showing problem not your entire program
for example problem maybe in calculating WinHeight !?

i.e. have you try the "faulty command" with hardcoded position ?
TextOut(100, 100, GetCatalogString(16, "Critical Error!"))

Re: TextOut command and text Justify

Posted: Mon Aug 26, 2024 10:28 am
by Flinx
Maybe your strings are too long?
Try to insert an argument table with WordWrap at the end of your string between the closing brackets "...), {WordWrap=600})" and replace the 600 with your window width.

Re: TextOut command and text Justify

Posted: Mon Aug 26, 2024 11:56 am
by SpawnPPC
I done, thanx !!!

bySpawnPPC

Re: TextOut command and text Justify

Posted: Mon Aug 26, 2024 1:35 pm
by Flinx
BTW, your second question is answered in the TextOut() manual entry: Add "Align=#JUSTIFIED" to the argument table. Of course this works only for exactly this text object.