How do I change the size of a textbox?

  • I'm trying to implement a tooltip. I have a textbox that shows when you hover over a sprite, but I have a problem with the size of the textbox. First thing I tried was resizing the text according to the text length but I found this isn't easily done. I'm okay with the box being the same size no matter how long the text is. But no matter how big I set the textbox in my layout, in the browser it has always the same size. I even tried to set the width via "on start of layout", but it still doesn't change. Why is this? How do I resize the textbox?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Don't use Text Box and other Form Control objects in your games, unless you absolutely need to. They are DOM elements, and have lots of issues - it's hard to style them, they are displayed above all layers, they have problems with positioning, they may be displayed differently in different browsers, they may "steal" focus and keyboard events will not work etc.

    In your case I suggest using a simple text, or a sprite font, or maybe even a static sprite with a few frames if you don't have many tooltips in your game.

    If you want your text to remain readable when shown on different backgrounds - use Sprite Font with an outline or its own background. Here is a very useful tool:

    construct.net/en/forum/game-development/tools-and-resources-27/sprite-font-generator-v3-64038

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)