Your own textbox

6
  • 23 favourites

Index

Attached Files

The following files have been attached to this tutorial:

.capx

tutorial-ext.capx

Download now 176.52 KB
.capx
.png
.png

unselected.png

Download now 250 B

Stats

7,563 visits, 18,584 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Basis

What you will need:

- ASCII Conventer online

Dont like standard html textbox? Let's make your own! Everything is much simpler than it seems.

For this example you will need only 2 objects. Keyboard and text object. Name it "source".

Now open Event sheet. Our first event will be:

On any key pressed -> source: append Keyboard.StringFromKeyCode(Keyboard.LastKeyCode)

Keyboard.StringFromKeyCode(Keyboard.LastKeyCode) - this may look scary.

Let's analyze in detail:

Keyboard.LastKeyCode - will return character ASCII code

For example:

if you press on your keyboard...

A it will return 65

B will return 66

! will return 33

Keyboard.StringFromKeyCode - will return string describing the character of the specified ASCII code

For example:

Keyboard.StringFromKeyCode(65) = A

Keyboard.StringFromKeyCode(33) = !

Keyboard.StringFromKeyCode(37) = %

So we combined these two expressions and that's what we got:

It shows every button which we press. Now we need to separate symbols that we need.

All English characters (in upper case) have ASCII codes from 65 to 90.

Now by using "System -> Compare two values" we can add two conditions.

Now it displays only letters.

  • 1 Comments

  • Order by
Want to leave a comment? Login or Register an account!
    • [-] [+]
    • 1
    • Fib's avatar
    • Fib
    • 1 points
    • (0 children)

    Thanks for the basics. A few huge things to add on to this that most text editors have is cut/copy/paste, cursor navigation, and text highlighting.