Bill Spitzak wrote:
> Matthias Melcher wrote:
> 
>> And it needs three characters to be encoded in utf8. The mentioned shortcut 
>> modifiers function is a left-over from the Forms Library. I would not put 
>> that much thought into it. Just choose something that is unlikely to be used 
>> as a shortcut character (because once it is a modifier, it can't be a 
>> character anymore, right?). How about the tilde ~ ?, or the vertical bar | ?
> 
> Actually no problem with using a symbol somebody may have used as a 
> shortcut. You can make "!A" mean command+A, while at the same time make 
> just "!" mean "!".

        Right, so to get '!' as a literal shortcut, you'd maybe have the choice 
of:

        AS INTEGER:
                FL_SHIFT+'1'    -- string equivalent would be: "+1"
                '!'             -- string equivalent would be: "!"

        AS STRING:
                "!"             -- integer equivalent would be: '!'
                "+1"            -- integer equivalent would be: FL_SHIFT+'1'

        And that seems that would be consistent with your previous post
        where case doesn't matter when specifying shortcuts:

                'a'          -- unshifted 'a' (string equivalent "a" or "A")
                'A'          -- unshifted 'a' (string equivalent "A" or "a")
                FL_SHIFT+'a' -- shifted 'a' (string equivalent "+a")
                FL_SHIFT+'A' -- shifted 'a' (string equivalent "+A")

        I can go either way on the casing of the letters being relevant,
        as long as the method chosen works consistently across all platforms.

> Another possibility is to just make '^' mean command. It is the same as 
> CTRL on Windows and Linux, right?

        Can we change the definition of "^" this late?
        Historically, "^c" has always meant Ctrl-C on all platforms, including 
macs,
        IIRC.

        With new codes, "!c" could mean Command-C on macs, and Ctrl-C on 
windows/linux.

        So one would use this to define the shortcut for e.g. the Edit/Copy 
menu,
        and it would work across all platforms, and avoid having to do:

#ifdef MAC
        copy_shortcut = FL_META+'c';
#else
        copy_shortcut = FL_CTRL+'c';
#endif

        The reason I need this is I have external config files that define the
        menu bar for my app, a different file for each language.

        I need an "ascii way" to specify shortcuts in this file, and have those
        codes work across all platforms, so that I don't need to add if/else 
platform
        detection logic to the file.

        So to specify ^C for the Edit/Copy menu item is tricky to do in a
        platform agnostic way, without special codes.

        I could implement the codes I want in my app, but it seemed all I was
        doing was working around something FLTK should probably already do.
        If it's too complicated to solve here, I can fall back to making my own
        shortcut codes for my app's needs.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to