[fltk.general] Re: "Flat" App Scheme

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
Previous Message ]New Message | Reply ]Next Message ]

Re: "Flat" App Scheme Ian MacArthur Apr 27, 2021 top right image

On Tuesday, 27 April 2021 at 12:57:55 UTC+1 pvrose wrote:

Is there a way to globally change styles for buttons? Or do you have to code each one individually?

Hi Phil,

If I were being glib, I might say yes. 
But that wouldn't be answering the question you are really asking, which is whether there exists some "magic" setting we can toggle that will then change all the buttons to the FLAT style in one go, and the answer to *that* is no.

However, if you do want to change the buttons, there are a few ways to go:

1: Just set 'em all to FL_FLAT_BOX individually when you declare 'em. It's only one line of code extra per widget... 

2: Walk the widget hierarchy and set each widget as you go. A PITA to do, but allows the button style to be changed "dynamically" at runtime.

3: Derive your own button class and add a (static) method that allows the style to be changed "globally" on the fly. Now, I've done this in the past, but don't really recall the details. ISTR that I had to tweak the draw() method of the derived class to check the "global" style for each redraw(), such that setting the "global" flag and calling redraw() on the main window had the desired effect. But... I can't find the an actual example here.


You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/2b4283fb-fa20-4094-9df4-ed43892b4f4en%40googlegroups.com.
Direct Link to Message ]
bottom left image   bottom right image
Previous Message ]New Message | Reply ]Next Message ]

Comments are owned by the poster. All other content is copyright 1998-2022 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.