GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  ]

class Fl_Check_Button

Class Hierarchy

Include Files

    #include <FL/Fl_Check_Button.H>


Buttons generate callbacks when they are clicked by the user. You control exactly when and how by changing the values for type() and when().

Fl_Check_Button widget

The Fl_Check_Button subclass display the "on" state by turning on a light, rather than drawing pushed in. The shape of the "light" is initially set to FL_DIAMOND_DOWN_BOX. The color of the light when on is controlled with selection_color(), which defaults to FL_RED.


Fl_Check_Button::Fl_Check_Button(int x, int y, int w, int h, const char *label = 0)

Creates a new Fl_Check_Button widget using the given position, size, and label string.


User Comments [ Add Comment ]

From Anonymous, 18:18 Mar 24, 2004 (score=2)

I wish you had more information on how to make a check box instead of the default diamond shape.  Why isn't check instead of the diamond the default type?
Reply ]

From Anonymous, 17:23 Sep 30, 2004 (score=1)

Check button is the default, at least for me in fltk 1.1.4;

---- snip #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Check_Button.H> int main() {
    Fl_Window win(200,200);
    Fl_Check_Button but(10,10,100,25,"Check me");;
    return(Fl::run()); } ----
Reply ]

From Greg Ercolano, 19:50 Nov 09, 2004 (score=1)

An example of getting the value() back from Fl_Check_Button:

---- snip #include <FL/Fl.H> #include <FL/Fl_Window.H> #include <FL/Fl_Check_Button.H> static void Check_CB(Fl_Widget *w, void*) {
    Fl_Check_Button *check = (Fl_Check_Button*)w;
    printf("check=%d\n",(int)check->value());    // calls Fl_Button::value() } int main() {
     Fl_Window win(100, 100);
     Fl_Check_Button check(10,10,80,80,"Test");
     return(Fl::run()); } ---- snip
Reply ]

From Mark T., 07:31 Sep 30, 2004 (score=1)

The width and height specified in the constructor are the size of the entire widget, and thus the size of the area which can be clicked to change the button's state.  The rectangle drawn for the "light" is always drawn the same size (about 13x13 on Windows).

To insure that the user can click anywhere on the "light", make the Fl_Check_Button's size at least 17x14.  However, in most cases it is user-friendly to allow the user to click on the label (text) beside the box as well, so the width may be increased to allow this.  Extra height may also aid the user.
Reply ]


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