First you need to assign callback to desired Fl_Menu_Item, whose colors
you are going to change. From callback you can access Fl_Menu_Bar and by
using mvalue() member, you can access to selected item; from there you
can change label color, background and etc.

Here is example:

static void color_cb(Fl_Widget *w, void*) {
  Fl_Menu_Bar *bar = (Fl_Menu_Bar*)w;
  if(!bar->mvalue()) return;

  Fl_Menu_Item *self = (Fl_Menu_Item*)bar->mvalue();
  self->labelcolor(FL_RED);
}

// your Fl_Menu_Item table:

static Fl_Menu_Item table[] = {
  {"&File", 0,0,0,FL_SUBMENU},
  {"To red", 0, color_cb},
  {0}
};

Sanel

On 01/23/2013 12:09 AM, Howard Rubin wrote:
> I have an Fl_Menu_Bar with a few added items that have the
> FL_MENU_TOGGLE property. This adds checkboxes to the menu.
> 
> I need to change the visual indication that each menu item has been
> clicked from the checkbox to toggling menu item foreground (text) and
> background colors.
> 
> Obviously I could eliminate the FL_MENU_TOGGLE property if that'd help.
> 

_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to