How can I change widget style? fltk 1.3.3, C++

1,332 views
Skip to first unread message

武亚军

unread,
May 4, 2015, 11:28:09 AM5/4/15
to fltkg...@googlegroups.com
I am building a fltk text editor and wondering how to change the style of the window and other widgets, like gtk or else.

The default style under Windows looks pretty simple. So is there a way to set the style of a widget or the whole application?

No method like window->style() exist, and I haven't found an entrance to search in fltk offical documentation site.

I am using C++, and fltk is in 1.3.3 version.

Thank all of you !

Greg Ercolano

unread,
May 4, 2015, 11:38:50 AM5/4/15
to fltkg...@googlegroups.com
On 05/04/15 05:13, 武亚军 wrote:
I am building a fltk text editor and wondering how to change the style of the window and other widgets, like gtk or else.

The default style under Windows looks pretty simple. So is there a way to set the style of a widget or the whole application?

    See Fl::scheme()..
    Using that at the top of main() in your application will affect the entire program, e.g.



        int main() {
            Fl::scheme("gtk+");    // "gtk+" and "gleam" are popular schemes
            ...



MacArthur, Ian (Selex ES, UK)

unread,
May 4, 2015, 11:43:56 AM5/4/15
to fltkg...@googlegroups.com
> I am building a fltk text editor and wondering how to change the style
> of the window and other widgets, like gtk or else.

> The default style under Windows looks pretty simple. So is there a way
> to set the style of a widget or the whole application?

> No method like window->style() exist, and I haven't found an entrance to
> search in fltk offical documentation site.


If you want fancy eye-candy effects, fltk may be the wrong toolkit for your needs.

It doesn't directly support complex themes (by design) though you can build any look you like if you do the widgets yourself.

There are a few built-in "schemes" that cover most general use, so try those. (Check the docs for Fl::scheme(...) to see how that works.)

Then look at what Greg does in these examples to style his own custom widgets...

http://www.seriss.com/people/erco/fltk/Fl_Gel_Tabs/

http://www.seriss.com/people/erco/fltk/Fl_Matte_Button/


You can do fairly fancy stuff with fltk, with a little effort. Here's ZynAddSubFX for example.

http://zynaddsubfx.sourceforge.net/

And there are a lot of other fltk based projects using custom widgets to get a more interesting look.




Selex ES Ltd
Registered Office: Sigma House, Christopher Martin Road, Basildon, Essex SS14 3EL
A company registered in England & Wales. Company no. 02426132
********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************
Reply all
Reply to author
Forward
0 new messages