FLTK logo

Re: [fltk.general] Right clicking on a check button label

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: Right clicking on a check button label supsm17 May 07, 2022  
  Ah, sorry about that. As for populating the array, I sort of copied an example from the docs:

{"&alpha", FL_ALT+'a', the_cb, (void*)1},
{"&beta", FL_ALT+'b', the_cb, (void*)2},
{"gamma", FL_ALT+'c', the_cb, (void*)3, FL_MENU_DIVIDER},
{"&strange", 0, strange_cb},
{"&charm", 0, charm_cb},
{"&truth", 0, truth_cb},
{"b&eauty", 0, beauty_cb},
{"sub&menu", 0, 0, 0, FL_SUBMENU},
{"one"},
{"two"},
{"three"},
{0},
{"inactive", FL_ALT+'i', 0, 0, FL_MENU_INACTIVE|FL_MENU_DIVIDER},
{"invisible",FL_ALT+'i', 0, 0, FL_MENU_INVISIBLE},
{"check", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE|FL_MENU_VALUE},
{"box", FL_ALT+'i', 0, 0, FL_MENU_TOGGLE},
{0}};

it's essentially a combination of the 1st (&alpha) and 8th (sub&menu) one. It seems to be working after adding the last blank item
On Saturday, May 7, 2022 at 8:21:32 AM UTC-7 lifeatt...@gmail.com wrote:
This is the simpliest menu declaration I would use:

Fl_Menu_Item menu_item[] = {
 {"name", 0, nullptr, (void*)(int_ptr)},
 {0}
};

The o->copy code is looking for the zero-filled item as a terminator.

Thanks a lot, I have a bit of an issue though...
Here is my code (roughly, my memory isn't perfect):

Fl_Menu_Item menu_item[] = { {"name", 0, nullptr, int_ptr } }; // here int_ptr is a int* which exists for the entire duration of the program
Fl_Menu_Button* o = new Fl_Menu_Button(400, 30, 40, 15);
o->copy(menu_item); // < here, it crashes and complains about menu_item.size()

Do you know what this might be caused by, and how it could be fixed?
 

--
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/12795abc-7928-4679-952c-e4b343346042n%40googlegroups.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'.