Jump to content

Numeric keypad


ForTest

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 :) 

Link to comment
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

Link to comment
Share on other sites

  • 2 years later...

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 ()?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...