FLTK logo

Re: [fltk.general] Fl_Menu_Item callback value

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Fl_Menu_Item callback value imm May 15, 2022  
 
On Sun, 15 May 2022, 19:54 supsm17 wrote:
I have a Fl_Menu_Button with some menu items inside it. The menu items look like this:
{ {"label", 0, reinterpret_cast<Fl_Callback*>(callback), 0, FL_MENU_TOGGLE}, {nullptr}}

callback looks like this:
void callback(Fl_Menu_Item* o, void* v)
{
    std::cout << o->value() << std::endl;
}

For whatever reason, it always returns FL_MENU_VALUE (4), regardless of whether I checked or unchecked the box. From the docs it says it should return 0 if the item is not checked. Where have I gone wrong?

You'll need to show us much more than that for us to have any chance of commenting usefully here, I suspect.

In your attempt to diagnose this problem, have you made a minimal (compilable) example to investigate the issue? What does it show? Can you post that example here for us to see what you have done?

--
Ian
From my Fairphone FP3

--
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/CAGFM6dZO%3Dcti8AC_a17cmuE%3DD1rQ7w8n%2BmpGFQqyFem6ueM_qw%40mail.gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.