Blank screen on m2_null_element

Best friends,

I'm using the graphic display 128x64 with ST7920. The u8g object setup I'm using:

U8GLIB_ST7920_128X64_1X u8g(52, 53, 51);

The M2 object and constructor I'm using:

M2tk m2(&m2_null_element, m2_es_arduino_rotary_encoder, m2_eh_4bd, m2_gh_u8g_bf);

I made a little menu:

m2_xmenu_entry xmenu_main[] =
{
    { "Disable All", NULL, disable_all },
    { "Devices", &el_devimenu_xylist, NULL },
    { "Enable All", NULL, enable_all },
    { "Settings", &el_settmenu_xylist, NULL },
    //{ "Disable All", NULL, disable_all },
    { NULL, NULL, NULL },
};

With "Disable All" I will call the function "disable_all":

const char *disable_all(uint8_t idx, uint8_t msg) {
    reactivate = true;
    stat_prin = false;
    digitalWrite(printer, LOW);
    m2.setRoot(&m2_null_element);
}

There is no problem when I use the menu like above but when I replace the first line of the menu to the last line I get a blank screen when I use ''disable all''.

Also when I use:{ "Exit", &m2_null_element, NULL }, ass last line of the menu I get a blank screen, when I put this on another line I got the graphics.

Can someone tell me why I have these problems and how I can fix them?

As seen in the example in the reference manual, you must check the msg parameter and also you should return a useful value.

const char *disable_all(uint8_t idx, uint8_t msg) {
  if ( msg == M2_STRLIST_MSG_SELECT  ) {
    reactivate = true;
    stat_prin = false;
    digitalWrite(printer, LOW);
    m2.setRoot(&m2_null_element);
   }
  return "";
}

Also note, that "m2.setRoot(&m2_null_element);" will always tell m2tklib that there is no menu required at the moment. As a result, m2tklib will not display anything (blank screen).

Oliver