Jump to content

Numeric keypad

Recommended Posts

Yes that's possible. The layout of the virtual keyboard widget is fully customizable. You can create your custom layouts and use that. It's all a matter of properly configuring the layout structs.

The easiest way to get this going is by looking at the implementation of the existing layout which you can find in the two files /src/gwin/gwin_keyboard_layout.[ch]. Once you created your own layout you can assign it using gwinKeyboardSetLayout().

Please show us a screenshot, photo, video or similar once you are done. We're very interested to see what you come up with :) 

Share this post

Link to post
Share on other sites

Yes, that is possible too. Every widget is completely customizable. There are two different ways you can customize an existing widget: WidgetStyles and Custom Rendering Routine: In case of you like how the different available rendering routines of a widget look like and you just want to change the colors, you can simply assign a different WidgetStyle to that widget using gwinSetStyle() (or gwinSetDefaultStyle() if you want to use it for all/most widgets). If you'd like to have complete control over how a widget is being rendered you can create your own custom rendering routine in your application code and use gwinSetCustomDraw() to assign it to the widget. There is a complete article on the wiki (linked above) that explains step-by-step how a custom rendering routine can be implemented and used.

Also, if you want to get one step further, it's possible to create custom widgets from scratch. That is explained here: http://wiki.ugfx.org/index.php/Creating_a_widget

Share this post

Link to post
Share on other sites

Hello. I created my own keyboard layout in gwin_keyboard_layout.c. :

static const GVSpecialKey Num1SKeys [] = {
{"\ 001", 0, GVKEY_SINGLESET, 1}, // \ 001 (1) = Shift Lower to Upper
{"\ 001", 0, GVKEY_INVERT | GVKEY_LOCKSET, 2}, // \ 002 (2) = Shift Upper to Upper Lock
{"\ 002", 0, GVKEY_INVERT | GVKEY_LOCKSET, 0}, // \ 003 (3) = Shift Upper Lock to Lower
{"123", 0, GVKEY_LOCKSET, 3}, // \ 004 (4) = Change to Numbers
{"Delete", "\ b", 0, 0}, // \ 005 (5) = Backspace
{"\ 015", "\ r", 0, 0}, // \ 006 (6) = Enter 1
{"\ 015", "\ r", 0, 0}, // \ 007 (7) = Enter 2 (Short keycap)
{"Sym", 0, GVKEY_LOCKSET, 4}, // \ 010 (8) = Change to Symbols
{"aA", 0, GVKEY_LOCKSET, 0}, // \ 011 (9) = Change to Lower Alpha

static const char * NumSet0 [] = {"\ 005 \ 005 \ 005", "789", "456", "123", "00 \ 006", 0};
static const GVKeySet NumSets [] = {NumSet0, 0};
const GVKeyTable VirtualKeyboard_Num1 = {Num1SKeys, NumSets};

I am trying to call  in my program gwinKeyboardSetLayout(& ghKeyboard, VirtualKeyboard_English1);
but I'm getting an error when compiling:
'VirtualKeyboard_English1' undeclared (first use in this function) main.c

But if in gfxconf.h I define: #define GWIN_KEYBOARD_DEFAULT_LAYOUT VirtualKeyboard_Num1 it works. What is the correct way to use gwinKeyboardSetLayout ()?


Share this post

Link to post
Share on other sites

and in general I have a problem with understanding, for example how to make the keyboard appear when I press on the input field and hide when I press "enter"

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...