TextFields... How to display properly?

You must Login before you can answer or comment on any questions.

If I use a set height on textfields I can use "top" to position them.

However, they look horrible on different devices with different resolutions.

I prefer to use "auto" for height. However, then "top" is not accurate for positioning.

If I use a tableview, then the focus stops working on all textfields. This is a confirmed bug.

So it does not seem there is a very good way to use auto sizing and still position fields.

What is the recommended way to do this?

I have thought about dynamically getting the height of the fields, but cannot find a way to do it.

— asked 10 months ago by Matt Weber
2 Comments
  • Can you provide sample code? I want to check it out and file a bug if necessary. As for "auto", it has been deprecated, use Ti.UI.SIZE instead

    — commented 10 months ago by Pedro Enrique

  • Hi Predro, thank you very much. Ti.UI.SIZE works great. It really helped a lot... along with the answer below for getting the text field height. Now my form looks great on a number of devices. I have found a post that shows the ListView focus bug was already files as a bug.

    — commented 10 months ago by Matt Weber

1 Answer

Accepted Answer

Hi , You can get height using :

win.add(textfield) // or whatever the parent is
h1 =  textfield.toImage().height;

— answered 10 months ago by Moiz Chhatriwala
answer permalink
6 Comments
  • Thanks a ton! I can't wait to try it. I'll still post code for Pedro so he can see the focus issue with tableviews.

    — commented 10 months ago by Matt Weber

  • It works perfectly. Thanks for sharing! I really appreciate it.

    — commented 10 months ago by Matt Weber

  • Most Welcome :)

    — commented 10 months ago by Moiz Chhatriwala

  • Show 3 more comments

Your Answer

Think you can help? Login to answer this question!