Scope of Fl::option()

11 views
Skip to first unread message

Rob McDonald

unread,
Jun 14, 2024, 8:01:05 PMJun 14
to fltk.general
What is the scope of Fl::option()?

Specifically, I'm looking at...

Fl::option( Fl::OPTION_ARROW_FOCUS, true );

Does it apply to the next widget added?  To all widgets added later?  To all widgets past and future (i.e. retroactively)?

Thanks,

Rob

Greg Ercolano

unread,
Jun 14, 2024, 8:48:55 PMJun 14
to fltkg...@googlegroups.com

On 6/14/24 17:01, Rob McDonald wrote:

What is the scope of Fl::option()?

    The Fl:: docs describe its scope as being global:
    """
    The Fl is the FLTK global (static) class containing state information and global methods for the current application.
    """

Specifically, I'm looking at...

Fl::option( Fl::OPTION_ARROW_FOCUS, true );

Does it apply to the next widget added?  To all widgets added later?  To all widgets past and future (i.e. retroactively)?


    It's application wide, affecting the behavior of all widgets in the application.
    Unless the docs for the flag say otherwise, assume it takes effect immediately and is global in scope.



Matthias Melcher

unread,
Jun 15, 2024, 6:49:05 AMJun 15
to fltk.general
Options are set by the user or the administrator on user or machine level. In 1.3, FLUID has an Options dialog for that. In 1.4, there is a new app named 'fltk-options' that can be used from the command line or as a GUI tool. Options are normally never set by an app, as they represent a user choice, not a developer choice. The machine level setting is read first, and the user setting can override the machine setting.

Apps can override the machine settings and the user settings by calling 'Fl::option(option, bool)'. The override takes effect immediately for this option for all widgets in the app for the life time of the app. The override is not saved anywhere, and relaunching the app will restore the old settings. 
Reply all
Reply to author
Forward
0 new messages