In the examples directory file
seems broken. If lines 159, 163, 167 are commented out
item->image(L_document_pixmap); // note: this clobbers the item's label()
item->image(L_folder_pixmap);
item->image(L_redx_pixmap);
then none of the Fl_Multi_Label images are displayed. Even the label images under File menu are not displayed. *BUT* if even one of the above item->image lines is executed then all the images under File menu are displayed. Looking at the original example filecreated by Greg E. I noticed that there are a couple lines removed in function AddItemToMenu in the current example in the git repo.
Specifically, the original code has these lines which were removed.line 118const char *itemtext = item->label();line 121item->image(*pixmap);and the edit to line 132ml->labelb = itemtext;
If I apply these changes, restoring the original code, then the example seems to work properly again. Wondering why those lines were removed from the original example?
I'm not quite awake yet, but I'm guessing this has to do with
changes made on Mon Sep 11 18:12:58 2017 +0000
as per a thread on fltk.coredev entitled "Fl_Multi_Label: leading
underbars in public API"
To read this thread which evolved over the period Sep 9 - Sep 15,
you can go here:
https://www.fltk.org/newsgroups.php?gfltk.coredev
..and then in the Search: bar type:
subject: Fl_Multi_Label:
..and that should show the interchange leading to the modification
which can be seen in git:
$ git diff 2a41af 88204a
..and here's the log entry for that change:@@ -117,6 +117,10 @@ int AddItemToMenu(Fl_Menu_ *menu, // menu to add item to
if ( !pixmap ) return i;
Fl_Menu_Item *item = (Fl_Menu_Item*)&(menu->menu()[i]);
+ const char *itemtext = item->label(); // keep item's label() -- item->image() clobbers it!
+
+ // Assign image to menu item
+ item->image(*pixmap); // note: clobbers item->label()
// Create a multi label, assign it an image + text
Fl_Multi_Label *ml = new Fl_Multi_Label;
@@ -127,7 +131,7 @@ int AddItemToMenu(Fl_Menu_ *menu, // menu to add item to
// Right side of label is text
ml->typeb = FL_NORMAL_LABEL;
- ml->labelb = item->label();
+ ml->labelb = itemtext;
// Assign multilabel to item
ml->label(item);