I have released a first version of M2TKLIB, a graphical and character user interface library for the Arduino Environment.
M2TKLIB is portable und uses existing libraries to build menues and dialog boxes. Supported libraries are
LiquidCrystal (so M2TKLIB should work with any Character LCD which is supported by the LiquidCrystal library),
Oliver,
I added a link to your library on the main glcd-arduino code page (it's there now) and I've also updated
the glcd library's included html documentation to include a link to it as well in a new "resources" section.
It will show up in the next glcd library release.
Thanks for killing another one of my projects (no, really... I can get on with what I need to do rather than write yet another semi-custom form handler).
One thing that seems to be missing is a way to send input events to M2TLKLIB from e.g. an interrupt handler connected to a rotary encoder or a custom keypad matrix.
Here are a couple of tiny diffs that add an event source message that soft-presses any of the keys, so that platform-specific input handling code can be used instead of hard buttons. I've only added support for the message to the Arduino eventsource, but I'm sure it would be portable.
It contains two new elements (widgets) and a scrollbar:
The new INFO and INFOP elements show a string (RAM or PROGMEM) with up to 254 lines. The scrollbar is also available:
The STRLIST element allows the selection of one line out of up to 254 lines:
The library is available for the dogm128 library, for the GLCDv3 library and the LiquidCrystal library. For the LiquidCrystal library, M2tklib redefines up to 4 characters to display a scrollbar:
Hahaha! Good work! I had the info as text_area to align with Java names and I had scroll bar too. Both elements were big pains to debug for me I bet the same for you!
Here is my recent work: a serial LCD keypad panel
It also has a full size 20X4 cousin. They're both sold on inmojo.com
Ahh, yes, after a lot of debugging, i decided to write a SDL interface for the graphics output. So now i can debug most of the M2TKLIB code with classical unix tools (gdb and friends). Still the remaining (hardware dependent) software parts make me trouble enough: it took me some hours to make the character redefinition correct :~
olikraus:
Ahh, yes, after a lot of debugging, i decided to write a SDL interface for the graphics output. So now i can debug most of the M2TKLIB code with classical unix tools (gdb and friends). Still the remaining (hardware dependent) software parts make me trouble enough: it took me some hours to make the character redefinition correct :~
Oliver
My biggest headache was integer math in the calculations. I realized that I was never used to it. Maybe should have taken a discrete math in college but too busy with other stuff and didn't taken any class from CSCI.
M2tklib builds menus and dialog windows on top of an existing graphics or
character library. Currently, M2tklib supports the following libraries:
Graphic LCDs:
GLCDv3
dogm128 lib
U8glib
Character LCDs:
LiquidCrystal
DogLcd lib (send PM)
Other character LCD libraries could be added on request.
Dialog elements include: Radio Buttons, Toggle Button, Combo Box, Text Entry,
Number Entry, Push Buttons, Dynamic length menues, Scrollbar (also for character LCDs),
Container Widgets (Grid, XY-List, ...)
Related to the current discussion on character menues: I recently developed a small menu for a user in the international part of this forum: http://arduino.cc/forum/index.php/topic,99105.0.html
Here are some screenshots of the character version of M2tklib:
Main menu with four entries, focus on the first:
A single selection menu with scrollbar (the scrollbar is composed of 4 user defined characters with pixel exact resolution):
A simple number entry dialog, focus on the number:
Same dialog, focus on the ok button:
The source code for these dialog entry screens is very simple and portable betwen graphics and character LCDs.
Great work! I posted some features of my library in the products forum. These are the features that need programming, other than just calling library functions.
Hello, I'm starting with this.
I'm testing the library and it seems to work great with GLCD
But I find the following difficulties.
M2_COMBO want the number of elements is dynamic from another variable to change at any time. For example from a configuration menu.
U8NUM (32) is the same with min and max value.
I miss an item type M2_DUMMY , that does not perform visual nothing but only to call a function.
M2_STRLIST with the "l" format option set to 1 could replace M2_COMBO. M2_STRLIST is more powerful and has a dynamic number of elements. Let me know if M2_STRLIST will be ok for your application.
I miss an item type M2_DUMMY , that does not perform visual nothing but only to call a function.
I do not fully understand this. You need something which does not display anything, but will call a function.
Maybe you can describe your desired application for this so that i get a better understanding for this. Also note that there is now an additional callback procedure which might help: Google Code Archive - Long-term storage for Google Code Project Hosting.
I have added an issue on the project page to implement M2_COMBO with changeable number of elements. Hope this is what you have requested.
M2_STRLIST is close to your request, but maybe an improved M2_COMBO might be better.
From a menu item. I want to execute a function
It is made with a button but I do not want to use the button.
I need an item that does not show anything and know that the menu item was who called
M2_STRLIST: Yes, M2_STRLIST is more like a toplevel element and is difficult to use in between other elements.
I will add a more flexible M2_COMBO with dynamic number of elements.
In COMBO would be interesting to know if the value of combo has changed by a msg in cb function.
There is no value change callback. Instead you can observe the value, which is modified by M2_COMBO
uint8_t var_for_m2_combo; // adr of this var is given to M2_COMBO
uint8_t prev_value; // this is a backup value to detect changes by M2_COMBO
...
void loop(void)
{
...
if ( prev_value != var_for_m2_combo )
{
// value has changed, do some action
...
prev_value = var_for_m2_combo;
}
}
From a menu item. I want to execute a function
With M2_2LMENU you can only call other menus. Use M2_STRLIST, which allows you to call other menues or execute procedures.
BTW: You should free the allocated memory in your callback proc.