[Lib] vKeyboard - a visual keyboard library

Post your working scripts, libraries and tools
A_AhkUser
Posts: 1125
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

[Lib] vKeyboard - a visual keyboard library

05 May 2018, 00:58

vKeyboard

Latest release - Download link
readme.md

A basic visual keyboard which has nevertheless the advantage to be customizable via a programmable interface and a functional graphical interface - to set up hotkeys. EDIT: removed from the current implementation Besides, the key JSON object descriptions (e.g. keyboard layouts) are uncoupled from the code.
It is designed to be easily handled using a PC game controller and comes with an autocomplete feature - on the model of the PS3 built-in OSK - which - and thanks in particular to the help of AlphaBravo here on the forum - supports not only normal text strings but also regular expressions. Incidentally, my debt to fenchai and its Universal_Searcher is obvious: I have taken up its idea of visualizing by a color, upon an user-defined prefix match, a given custom search. It has the advantage of showing the potential of the library in this showcase script.

Acknowledgements:
  • the AutoHotkey community
  • JSON (by coco)
  • special thanks to brutus_skywalker, coco, GeekDude, fenchai, helgef, ixiko, jeeswg, ManiacDC, Rohwedder and Uberi

Main features:
  • The visual keyboard is endowed with an eAutocomplete control, which allows autocompletion. This latter enables you, as you are composing text, to rather quickly find, get info tips and select from a dynamic pre-populated list of suggestions and, by this means, to expand/replace partially entered strings into/by complete strings. The eAutocomplete component allows fuzzy search.
  • The visual keyboard is designed to be easily handled using a 12keys-1POV-4axes PC game controller.
  • Basic event handling.
  • Customizable keyboard/joystick hotkeys, autocomplete lists, keyboard layouts and UI graphics.
  • WYSIWYG keyboard layouts maker.

The library is far from perfect: first of all because it unfurls against an undocumented background of many class (and because, a fortiori, there is lack of comments alongside the code...) which deprives a priori of the ability to make the most efficient use of it, as the case may be.
Hoping nevertheless that it can be useful, a source of inspiration, a source material or even all of these at the same time.
Last edited by A_AhkUser on 25 Jul 2020, 14:30, edited 6 times in total.
my scripts
Helgef
Posts: 4459
Joined: 17 Jul 2016, 01:02
Contact:

Re: Visual keyboard

05 May 2018, 13:02

Excellent work :bravo:. The example works very well. (ahk 1.1.28.00 64, win7)

Code: Select all

global Keypad :=
Interesting coding style, why don't you define it like class keypad?

Thanks for sharing, cheers :thumbup:.
A_AhkUser
Posts: 1125
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: Visual keyboard

05 May 2018, 20:51

Hi Helgef,
The example works very well. (ahk 1.1.28.00 64, win7)
I'm glad to know it works on Win7 :D - thanks.
Interesting coding style, why don't you define it like class keypad?
Sorry but not everyone is able to... keep all the functions inside the class... :headwall:
To be honest, in this case, I don't know why I decided to let a few this (I mean the one automatically inserted at the beginning of the parameter list of a method stored by reference) not to contain a reference to Keypad. Maybe for the sake of semantic rigour. Basically, when I don't set, in particular, property definitions I find this stucture to be - in my practice at least - functionnally equivalent (leaving aside certain aspects like the __class property, the fact that a class is set when the script is loaded etc.). Besides, it has the advantage to give the 'architecture' of the object in the continuation section on the top of the script.

Anyway, thanks for your comment Helgef.
my scripts
A_AhkUser
Posts: 1125
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: visual keyboard library

12 May 2018, 15:58

- Updated script's own underlying classes - and the object Keypad accordingly. The script now abides by the class syntax and consists of a single script.
- As of now, the word completion feature is optional.
- Both the height and width of the autocomplete (edit) control can henceforth be resized.
- Added a russian keyboard layout.
- The example has been amended to reflect these changes.
my scripts
A_AhkUser
Posts: 1125
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: [Lib] Keypad - a visual keyboard library

07 Jun 2018, 01:22

. Updated script, which now implements the last version - slightly modified - of another script of mine eAutocomplete.
. The keyboard does not longer steal focus from the active window.
. While it is still above all designed to be handle using a PC game controller, keys can now be clicked.
. The 'documentation' has been enriched and made clearer.
. Added some pics and updated the example in the OP.
my scripts
rickyc
Posts: 5
Joined: 04 Jun 2018, 01:41

Re: [Lib] Keypad - a visual keyboard library

22 Jun 2018, 02:15

This will be an incredible work which might help others. :clap: Can you provide an demo how actually it works on windows 7 that could help me out easily to focus on the script. :roll:
A_AhkUser
Posts: 1125
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: [Lib] Keypad - a visual keyboard library

25 Jun 2018, 00:10

Hi rickyc,

First, many thanks for your interest in the script. I guess you have already checked out the readme EDIT: fixed link, which provides an overview of the library. Because of the library-focussed orientation of the script, it does not provides any turnkey script nor an programmable interface instead.
As an example, the following sample script illustrates the basics of using the library: it creates and shows a visual keyboard, executes a custom function when the text is submitted and defines hotkeys to display the standard hotkey GUI:

Code: Select all

#NoEnv
#Warn
#SingleInstance force

; Hotkeys default to the following values:

    ; ALT+D / Joy12 - display/hide the visual keyboard.
    ; Enter / Joy3 - press the key currently focused *.
    ; ALT+S / Joy10 - autocomplete / submit the text entered.
    ; Backspace / Joy1 - remove the last character starting from the left-hand side of the caret/insert current position.
    ; ALT+Left / Joy5 - shift from right to left the caret/insert position.
    ; ALT+Right / Joy6 - shift from left to right the caret/insert position.
    ; Space / Joy9 - insert a space character
    ; ALT+Up / Joy7 - select the previous suggestion (predictive text input).
    ; ALT+Down / Joy8 - select the next suggestion (predictive text input).
    ; ALT+Enter / Joy4 - insert a line break.
    ; Left-Up-Right-Down / JoyPOV - navigate through keys.
    ; JoyXY - move the keypad window.

#Include %A_ScriptDir%\Keypad\Keypad.ahk

global VK := new Keypad("Debug", {editOptions: "h165 +Resize", startAt: 2, matchModeRegEx: true, appendHapax: 0})
; create a new instance of Keypad and set the autocomplete options
VK.setLayout("en") ; set the keyboard layout and shows the visual keyboard
VK.onSubmit := Func("K_submitEventMonitor") ; executes a custom function each time the text entered so far is submitted
VK.setHotkeys() ; set hotkeys without using the 'setHotkeysUI' method
OnExit, handleExit ; a script should call the destroy method, at the latest at the time the script exits
return

K_submitEventMonitor(this, _lastFoundControl, _input) {
	SendInput % "{Text}" . _input
}

!j::VK.setHotkeysUI("joystick")
!k::VK.setHotkeysUI("keyboard")

handleExit:
VK.destroy()
ExitApp
EDIT: code deprecated - see instead: sample example

As it is, the programmable interface is far from perfect and, I must admit, anything but user-friendly... That is all the more so in this case as it is experimental and reworked on a regular basis. Incidentally, it now uses a legacy version of eAutocomplete which I've just rewritten, so I might need to rewrite this one soon too, as soon as I have some time. I hope that the sample script can help you to figure it out the basics of using the library.


Cheers.
Last edited by A_AhkUser on 25 Jul 2020, 13:59, edited 1 time in total.
my scripts
A_AhkUser
Posts: 1125
Joined: 06 Mar 2017, 16:18
GitHub: AAhkUser
Location: France

Re: [Lib] Keypad - a visual keyboard library

24 Jul 2020, 10:05

Hi,

I made a full re-write of the script, renamed as 'vKeyboard':
. the script now uses JSON by coco (thanks coco).
. a basic KeymapMaker script allows to create the WYSIWYG-way keyboard layouts.
. the autocomplete component is more reliable and also supports fuzzy search.
. all GUI components are resizable.
. visual keyboard keys' associated callbacks.
. long/multiple clicks and presses handling.
. many other features

Please let me know about bugs. Suggestions are welcome. Thanks for reading cheers

A_AhkUser


EDIT:
hasantr wrote:
24 Jul 2020, 13:54
@A_AhkUser It's nice to see you active again. Your work is great.
Thanks much for your feedback hasantr really much appreciated

A_AhkUser
Last edited by A_AhkUser on 25 Jul 2020, 14:29, edited 1 time in total.
my scripts
User avatar
hasantr
Posts: 510
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: [Lib] Keypad - a visual keyboard library

24 Jul 2020, 13:54

@A_AhkUser It's nice to see you active again. Your work is great.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Bing [Bot], leosouza85 and 28 guests