Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Stopping button text going onto new line  (Read 1789 times)

0 Members and 1 Guest are viewing this topic.

Dan Peach

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 100
    • View Profile
    • Viperante - Game Development
Stopping button text going onto new line
« on: October 15, 2012, 03:29:06 PM »

Hello,

I have a button which acts as a text input field for my onscreen keyboard (for iOS). I need to limit the number of characters that can be entered so that the text doesn't go onto a new line, but I can't just set the length of the string because that doesn't work because some letters are wider than others. For example, in my text field, I can fit in 16 "m" characters, but if I set the length to not be greater than 16, then I can't fit in the words I need to fit in because they're more than 16 characters, even though they only fill up two thirds of the button.

So is there any way to just stop the button text from going onto a new line - obviously if it does that, it goes outside the background text field image. I just want the text to fill the button, right up to the point before it would go onto a new line, and then just not accept anymore characters. Can this be done?

Thanks. :)

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: Stopping button text going onto new line
« Reply #1 on: October 17, 2012, 04:46:39 PM »

Simply use a fixed width Font for the texts ( like bitmap fonts or something like Courier. There are several fixed-width truetype fonts available ).
Logged

Dan Peach

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 100
    • View Profile
    • Viperante - Game Development
Re: Stopping button text going onto new line
« Reply #2 on: October 18, 2012, 10:25:15 AM »

Thanks - that will solve the problem.  :)
 

Page created in 0.608 seconds with 23 queries.