|
|
On 6/15/21 9:34 AM, Robert Arkiletian
wrote:
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 file
created 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 118
const char *itemtext = item->label();
line 121
item->image(*pixmap);
and the edit to line 132
ml->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
@@ -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);
..and here's the log entry for that change:
$ git log 88204a5..2a41af1
Applied Manolo's recommendation (fltk.coredev),
removing unnecessary item->image(*pixmap) call.
I don't know if I'll have time to pick through that thread to figure
out a reduced answer
to your question, but perhaps you can put the pieces together before
I do..
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/358d58af-0acc-aed7-3b4d-35413d144c52%40seriss.com.
[ Direct Link to Message ] | |
|
| |