Author Topic: text:set_horizontal/vertical_alignment() issue ?  (Read 2942 times)

0 Members and 1 Guest are viewing this topic.

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
text:set_horizontal/vertical_alignment() issue ?
« on: December 26, 2016, 02:43:48 PM »
Hi.

When I was working on some scripts something went wrong.
I am using different surfaces to display a text, but this surface change it's alignement depending on the content itself.

However ...

The text surface is created in on_started, like so

Code: (lua) [Select]
self.text = sol.text_surface.create( blablabla )

There is a problem if I'm trying to change the text alignment on another function, for instance, in on_command_pressed()

Code: (lua) [Select]
self.text:set_horizontal_alignment("left")
An error occurs

Code: [Select]
calling set_horizontal_alignment on bad self (string expected, got userdata))
However, self.text:get_horizontal_alignment() works ...
« Last Edit: December 26, 2016, 02:47:11 PM by MetalZelda »

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1194
    • View Profile
Re: text:set_horizontal/vertical_alignment() issue ?
« Reply #1 on: December 26, 2016, 03:08:59 PM »
This is an engine bug indeed. I just fixed it, but there is no 1.5.3 scheduled for now. Il will be fixed in 1.6.
A workaround in the meantime is to create another text surface, setting the horizontal alignment at creation time.
« Last Edit: December 27, 2016, 06:00:24 PM by Christopho »

MetalZelda

  • Hero Member
  • *****
  • Posts: 551
    • View Profile
Re: text:set_horizontal/vertical_alignment() issue ?
« Reply #2 on: December 26, 2016, 03:12:22 PM »
Glad to hear that it is already fixed :P