ymobe / rapanui

High level API for MOAI framework
185 stars 48 forks source link

MOAITextBox.LEFT_JUSTIFY v MOAITextBox.RIGHT_JUSTIFY (Y position problem) #122

Open BenM1111 opened 11 years ago

BenM1111 commented 11 years ago

local MthPmtText = RNFactory.createText("Monthly Payment $", {size = 36, top = 0, left = 0, width = 200, height = 40, alignment = MOAITextBox.LEFT_JUSTIFY })

local MthPmtTextVal = RNFactory.createText(comma_value(mPmt), {size = 36, top = 0, left = 201, width = 200, height = 40, alignment = MOAITextBox.RIGHT_JUSTIFY })

I would think the above code should display the text at the same Y position, in this case 0. But it seems to actually display the LEFT_JUSTIFIED version a few pixels too high (maybe about 5?).

MattiaFortunati commented 11 years ago

Hi BenM1111, you are right! This happens because when you set alignment like in the code you posted, both vertical and horizontal alignments are set to LEFT or RIGHT. This is made due to chinese language compatibility.

If you want to set only one of them you should use:

hAlignment=MOAITextBox. RIGHT_JUSTIFY vAlignment=MOAITextBox.LEFT_JUSTIFY MthPmtText.textbox:setAlignment(hAlignment, vAlignment)

Let me know if it's working :D

BenM1111 commented 11 years ago

Hi Mattia,

Ok got it. Yes that works perfectly, thanks.

Now if I can just figure out how to get a build for device to actually work, I will be set. Now that is frustrating.