Englisch (german below)
As my last program (see quote at the end of this post) had some errors which is why it only worked in specific cases, I made an update to it.
Important is that you have to decide if you want a dynamic menu with submenus or one which should call an other function.
Always start the function with checking if you are in the correct line (like in the examples from Jomelo). Now the next call is either enable or disable the use of submenus, depending if this entry is one with or without submenus (see example code below.
Like this every time you are changing your cursor position you get the correct status for enter-button (enabled or disabled for dynamic entries).
German
Hallo, mein letztes Beispielprogram hatte leider einen Fehler, so dass es nur in bestimmten Situationen korrekt funktionierte. Daher hier ein Update.
Wichtig ist die Unterscheidung, ob der Menüeintrag Untermenüs hat oder nicht, je nachdem muss die Funktion leicht abgeändert werden.
Nach Prüfung, ob der Cursor auf der jeweiligen Linie des Menüs steht sollte man direkt bei einem Menü mit Untermenüs die Funktion "LCDML.MENU_enUseDynElementsWithSubElements();" ausgeführt werden, wenn das Menü keine Untermenüs hat muss "LCDML.MENU_disUseDynElementsWithSubElements();" ausgeführt werden. Danach ganz normal die Methode schreiben (siehe Beispiele unten).
LCDML_addAdvanced (0 , LCDML_0 , 1 , NULL, "" , t0, 0, _LCDML_TYPE_dynParam);
LCDML_addAdvanced (1 , LCDML_0 , 2 , NULL, "" , t1, 0, _LCDML_TYPE_dynParam);
LCDML_addAdvanced (2 , LCDML_0_2 , 1 , NULL, "" , t2, 0, _LCDML_TYPE_dynParam);
LCDML_addAdvanced (3 , LCDML_0_2 , 2 , NULL, "test3" , mFunc_screensaver, 0, _LCDML_TYPE_default);
LCDML_addAdvanced (4 , LCDML_0_2 , 3 , NULL, "" , t3, 0, _LCDML_TYPE_dynParam);
LCDML_addAdvanced (5 , LCDML_0_2_3 , 1 , NULL, "test3" , mFunc_screensave 0, _LCDML_TYPE_default);
LCDML_addAdvanced (6 , LCDML_0_2_3 , 2 , NULL, "test5" , mFunc_screensaver, 0, _LCDML_TYPE_default);
#define _LCDML_DISP_cnt 6
LCDLM_createMenu(_LCDML_DISP_cnt)
//[...]
// this should call a function (not any submenus)
void t1(uint8_t line) {
if (line == LCDML.MENU_getCursorPosition()) {
LCDML.MENU_disUseDynElementsWithSubElements();
if (LCDML.BT_checkAny()) {
if (LCDML.BT_checkEnter()) {
//do whatever you want
}
}
}
// write what will be shown on screen
}
// this is a menu with submenus (enter should call submenus)
void t2(uint8_t line) {
if (line == LCDML.MENU_getCursorPosition()) {
LCDML.MENU_enUseDynElementsWithSubElements();
if (LCDML.BT_checkAny()) {
if (LCDML.BT_checkEnter()) {
// not active, cannot do anything
}
}
}
// write what will be shown on screen
}
Edit:
Now I found a way to implement it, thanks. I post my example below and explain it here:
The idea is to enable the SubElements part in the function where you want to have NO subelements. Like this it is active all the time.
If no the line number is the same as the cursor-position, you disable the dynamic subelement with the function
LCDML.MENU_disUseDynElementsWithSubElements();
Like this the enter button can be used again fo entering the function (I'm calling a function t3 for testing here, this can be used for pretty much everything).
It has to be in this order, otherwise it is not working!
Now I just have to figure out how I can modify the display_menu function in a way I want it 
Code: [Select]
LCDML_addAdvanced (22 , LCDML_0 , 7 , NULL, "" , t1, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
LCDML_addAdvanced (23 , LCDML_0_7 , 1 , NULL, "" , t2, 0, _LCDML_TYPE_dynParam); // NULL = no menu function
LCDML_addAdvanced (24 , LCDML_0_7 , 2 , NULL, "test3" , mFunc_screensaver, 0, _LCDML_TYPE_default); // NULL = no menu function
void t2(uint8_t line) {
LCDML.MENU_enUseDynElementsWithSubElements();
if (line == LCDML.MENU_getCursorPos()) {
LCDML.MENU_disUseDynElementsWithSubElements();
if(LCDML.BT_checkAny()) {
if(LCDML.BT_checkEnter()) {
t3();
}
if (LCDML.BT_checkLeft()) {
counterTest--;
}
if (LCDML.BT_checkRight()) {
counterTest++;
}
}
}
Serial.print("d:");
Serial.print(counterTest);
Serial.print(", ");
Serial.print(timeMilli);
}