> On Friday, September 23, 2016 at 6:06:02 PM UTC+10, Manolo Gouy wrote:
> > Le 23 sept. 2016 ą 08:56, Svets a écrit :
> > Is there any way to add a forward slash to an Fl_Choice combobox menu?
> > Fl_Choice::add("DD/MM/YYYY");
> > results in the combobox only displaying the "DD" with an option to choose the "MM".
> > Obviously it sees the / slash as being part of a directory path.
>
> You can construct the menu item without /
> Fl_Choice *myflchoice = ...;
> int index = myflchoice ->add("DD-MM-YYYY");
> and then rename it
> const Fl_Menu_Item *item = myflchoice->menu() + index;
> ((Fl_Menu_Item*) item)->label("DD/MM/YYYY");
> On 09/25/16 08:33, Svets wrote:
> Thanks for that.. I'll keep that in mind as well ;)
Yes, that technique can be useful if you're taking human supplied
content, such as from a config file that defines menu items and
their labels.
With Manolo's suggestion, you won't have to first convert the
string by escaping the slashes.. you can just pass the content
straight in.
The other thing to watch out for is "@" in your strings; those
are parsed as "symbols", and have to be escaped with another @ sign,
or you'd have to disable symbols globally in your app:
http://seriss.com/people/erco/fltk/#DisableSymbols