Il tuo box di testo personalizzato

1

Index

Tagged

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

5,410 visits, 7,734 views

Tools

Translations

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.

Basi

Ciò di cui hai bisogno:

- ASCII Converter online

Non ti piace il box di testo standard di html? Creane uno personalizzato! E' molto più semplice di quanto possa sembrare.

Per questo esempio avrai bisogno solo di due oggetti. L'oggetto "Keyboard" e "Text Object" che chiamerai "source".

Ora apri l'Event Sheet. Il nostro primo evento sarà:

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

Keyboard.StringFromKeyCode(Keyboard.LastKeyCode) - Sembra piuttosto spaventoso, ma analizziamolo nel dettaglio:

Keyboard.LastKeyCode - restituirà il codice ASCII del carattere

Per esempio:

se sulla tua tastiera premi un tasto...

A restituirà 65

B restituirà 66

! restituirà 33

Keyboard.StringFromKeyCode - restituirà la stringa che rappresenta il carattere specificato dal codice ASCII

Per esempio:

Keyboard.StringFromKeyCode(65) = A

Keyboard.StringFromKeyCode(33) = !

Keyboard.StringFromKeyCode(37) = %

Quindi abbiamo combinato queste due espressioni e questo è ciò che otterremo:

Viene mostrato ogni tasto che noi premiamo. Ora è necessario separare i simboli di cui abbiamo bisogno.

Tutti i caratteri inglesi (maiuscoli) hanno codici ASCII da 65 a 90.

Usando "System -> Compare two values" aggiungiamo due condizioni.

Ora verranno visualizzate solo le lettere

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!