Limit characters

  • Hello everybody.

    I want to know how I do to limita a text??

    I create a Virtual Keyboard and when I click in one number, the number appears in the box (the box is a Text, not a textbox), but if I click in 7 numbers, the numbers desappears.

    How I limit the characters ( the numbers in my game isn't a numbers couse I use "." ) in my game, and how I limit the point (".") in the text??

    thanks so much.

  • pablolink23 Do you mean something like this. CapX

    Edit: Small update

  • Give me your e-mail!!!!

  • Yes Katala, but, I don't use Buttons, mu vitual Keyboar is with sprites...

    but your exemple is very good!!

    How I do with sprites???

    thanks!

  • pablolink23 Use mouse object:On object clicked

    And I could recommend some basic tutorials <img src="smileys/smiley20.gif" border="0" align="middle" />

  • I understanding your exemple!

    But, if you want to clear the numbers end put other?

    What I do?

  • pablolink23 On object clicked ->

    Text: Set text ""

    Text: Set Character_count to 0

  • Well, I want to set price and edit tris price!!!

    in a Text (isn't a textbox)

    I create a button that clear the last number, but when I clear, I can't edit the text...

  • When you use Len(text) you can't edit the text!!!

  • I added a sprite to the example made by Katala

    with clear button

    Push the pink aquare to clear the text. Easy right?

    Have a look at the 1 event I added for that effect.

    Learn how to work with C2 and you won't have to ask for everything.

    Have you seen the green button on top of this page that says tutorials?

    It works!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Good exemple, but you can edit this text only one time!!

    In my exemple, You Clean number for number... and edit how you want!

  • Ok fixed it, re-download my .capx. You now clean number for number.

  • Well, In my project I can't use Button couse I will export with CoCoonJS

    and this mode don't acept!

    where is you capx?

    thanks so much!

  • the same link as before.

    If you don't know how to change the buttons into sprites that do the same thing you might want to learn more about how Construct2 works. These are simple events and you should be able to make them yourself.

  • Well,I know how I use the buttons, but I can't use buttons couse when I export my project, I use CocoonJS...and CocoonJS don't acept buttons(or textBox)

    That Link giveme the same project...

    If you put :

    Mid(Display.Text,0,Len(Display.Text)-1)

    you will can clear number by number....

    I want a mode How I create buttons(with sprite) and set my information(numbers) in a Text (not a text box)...and edit my text???

    My project is about a Grossery Store...and the Gameplayer will can set the price in all things...

    I know the basic about the construct! but I work with a complex game...with math/fisics and others things!

    thanks so much!

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