> On 8 Dec 2007, at 3:31, Daniel Gollas wrote: > > > I have a big problem with the way menu item labels are handled, and > > I think it's been rethought for 2.0. > > > > Basically, if I want to add a file path to a menu in Windows (which > > of course gives me filenames with backward diagonals C:\some\path\to > > \a\file.txt), fltk will create a hierarchy of menus, which is > > really not what I want. This works well on *nix type file systems, > > where the full path to a file starts with /, and fltk will then > > ignore the hierarchy and place the name correctly. But what about > > Windows and other non / starting paths?, I know I can replace all > > the \ for escaped \ (\\) but this could get complicated fast. I > > suggest a way to disable the automatic hierarchy creation is > > implemented (If there isn't already and I'm just making a fool of > > myself) > > This is implemented in Fl_Menu_Add.cxx, and I doubt it can be changed > now without (potentially) breaking backward compatibility, so I think > you may be stuck with it for fltk-1.1.x. > Mind you, I suppose you could modify the code so that, in the win32 > case, it specifically looks for "X:" (where X is any alpha char) at > the start of the string, in the same way it currently checks for "/" > as the first char in the string. That should work. If your app is > statically linked to fltk, you *could* make your own version of > Fl_Menu_Add that does what you want. > > Or, less invasively but less cosmetically acceptable, just add a > #ifdef WIN32 section to your code that pre-pends a leading '/' to > your pathnames where they get passed in to make the label... so "C: > \some\path" appears as "/C:\some\path" which looks a bit rubbish but > at least it should work! >
I guess the clean solution in this case is to add a / befor the drive letter, but then I would have to remove it before using the text value and the / would appear on the menu item. It seems to be the only workaround. Thanks anyway! _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

