Fl_Counter

5 views
Skip to first unread message

holm.h...@gmail.com

unread,
May 18, 2021, 4:43:55 PM5/18/21
to fltk.general

Hello,

Is there a way to set the background of a  Fl_Counter widget ?
I want to replace the white field with another color.
  color() set the color of the buttons
  textcolor set the color of the font
  labelcolor do not have any effect.

Best regards
Håvard

Ian MacArthur

unread,
May 19, 2021, 5:43:43 AM5/19/21
to fltk.general
Hmm, possibly not... 
Looking at the sources, the box that holds the digit seems to be hard-coded to  FL_BACKGROUND2_COLOR

at line 54 or thereabouts:

  draw_box(boxtype[0], xx[0], y(), ww[0], h(), FL_BACKGROUND2_COLOR);

So... well, you could try changing FL_BACKGROUND2_COLOR but that might have "unhelpful" side effects in other widgets.
Or copy/paste the Fl_Counter code and modify the widget to take a user selectable background colour in place of the hard-coded FL_BACKGROUND2_COLOR.


Reply all
Reply to author
Forward
0 new messages