Jibble

Author Topic: MODULE: TextField v1.2.0  (Read 700 times)

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
MODULE: TextField v1.2.0
« on: 28 Mar 2018, 15:39 »
This is a quick little module I made for the AGS Awards client. It provides one-line text input fields, as a replacement for the AGS TextInput control.

Ways in which TextField is better than TextInput:
-It has a blinking text cursor
-You can position the cursor anywhere in the text (using mouse or arrow keys), and edit at that point
-It has a notion of focus, so that you can have multiple TextFields displayed without all the text being entered into all the fields
-You can define a max string length the field will accept
-You can make the border partially transparent
-You can add more advanced logic to it, e.g. to only accept certain character types, or to *** out the display of the text

Ways in which TextField is worse than TextInput:
-It's implemented in script, so on slow computers or in a resource-intensive game it could be less responsive than TextInput
-You have to do a little bit of setup to make it work
-You can't link the OnActivate event, so it's a little more complicated to respond when the player presses Return/Enter

The TextField module is available on Github.

Download TextField v1.2.0

You can also try it out in a demo game for the Clipboard plugin:

Download Clipboard Demo

Changelog:
1.2.0
- Fixes crash if TextField initialized with non-empty String
- Adds support for Clipboard plugin

1.1.0
- Initial release
- Fixes poor SHIFT-key detection

1.0.0
- Unreleased (used in AGS Awards 2017 client)
« Last Edit: 30 Mar 2018, 14:20 by Snarky »

selmiak

  • Posts: 3,846
  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on a game that was nominated for an AGS Award!
Re: MODULE: TextField v1.1.0
« Reply #1 on: 28 Mar 2018, 17:19 »
nice. What I really missed during the awards ceremony was copy+paste. Is it possible to implement this?

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: MODULE: TextField v1.1.0
« Reply #2 on: 28 Mar 2018, 17:42 »
It would be pretty easy to do copy-paste between different text fields within an AGS game, but presumably you mean copy-paste from other applications.

That would require a plugin, in order to access the Windows clipboard. I have looked into it a tiny bit, and it's probably not very hard if you know your way around the APIs and libraries and build processes, but... I don't.

See thread here: http://www.adventuregamestudio.co.uk/forums/index.php?topic=55797.0
« Last Edit: 28 Mar 2018, 17:44 by Snarky »

arj0n

  • Mittens Vassal
  • Posts: 2,850
  • art consists in drawing a line somewhere
    • arj0n worked on a game that was nominated for an AGS Award!
Re: MODULE: TextField v1.1.0
« Reply #3 on: 29 Mar 2018, 15:27 »
Haven't tested this yet, but it looks like this could be very useful for textparser games. Thanx for making this!

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: MODULE: TextField v1.2.0
« Reply #4 on: 30 Mar 2018, 14:18 »
nice. What I really missed during the awards ceremony was copy+paste. Is it possible to implement this?
That would require a plugin, in order to access the Windows clipboard. I have looked into it a tiny bit, and it's probably not very hard if you know your way around the APIs and libraries and build processes, but... I don't.

I decided to go ahead and figure it out, and here's a plugin to do it. This module has been updated with support for the plugin, although because I haven't implemented selection, Ctrl-C will copy the entire text of the field.

Gurok

  • Rottwheelers
  • Posts: 1,791
  • When life hands you lemons, combine them with the mop
    • I can help with AGS tutoring
    • Best Innovation Award Winner 2016, for improving and extending the AGS scripting language
    • I can help with proof reading
    • I can help with scripting
    • Gurok worked on a game that was nominated for an AGS Award!
      Gurok worked on a game that won an AGS Award!
Re: ENGINE PLUGIN: Clipboard v0.4
« Reply #5 on: 30 Mar 2018, 16:04 »
Thanks. Sure, undo/history would be useful to have, but it wouldn't be part of the plugin, but rather something you implement in your game logic. I'll think about adding it to the TextField module.

Windows Forms stuff gives you one level of undo built into the control from memory. It might be nice to provide that, then let people implement their own if they need to.

Snarky

  • Global Moderator
  • Posts: 6,705
  • Private Insultant
    • I can help with proof reading
    • I can help with translating
Re: ENGINE PLUGIN: Clipboard v0.4
« Reply #6 on: 30 Mar 2018, 16:25 »
It's something to think about for the TextField module. In that case I'd almost certainly make the size of the history buffer (how many levels of undo you can backtrack) configurable.
« Last Edit: 31 Mar 2018, 07:01 by Snarky »

selmiak

  • Posts: 3,846
  • ǝsıɔɹǝxǝ ʞɔǝu puɐ uıɐɹq
    • I can help with play testing
    • I can help with proof reading
    • I can help with translating
    • I can help with web design
    • selmiak worked on a game that was nominated for an AGS Award!
Re: MODULE: TextField v1.2.0
« Reply #7 on: 30 Mar 2018, 19:10 »
that was fast (and hopefully easy enough). Thanks snarky  :-D

Monsieur OUXX

  • Posts: 3,537
  • Mittens Half Initiate
    • I can help with proof reading
    • I can help with translating
    • I can help with voice acting
Re: MODULE: TextField v1.2.0
« Reply #8 on: 16 Apr 2018, 10:58 »
Snarky, if you could extend this to multiple lines, I'd be eternally grateful to you.
Also I'd really encourage you to implement highlight and simple copy/paste (data stays within AGS). You could probably get some inspiration about mouse-control and highlight from my (almost working but eternally slightly broken) module, TextArea.

I realy need a text area component, but I've never managed to release one that's bug free.