FLTK logo

Re: [fltk.general] Re: can I change the default attributes so I can set"global attributes"

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: Re: can I change the default attributes so I can set"global attributes" Manolo Oct 01, 2022  
 

Le dimanche 2 octobre 2022 à 05:42:32 UTC+2, roger a écrit :
I have been thru Enumerations and I can't find the variable so how to do I set all box types to FL_THIN_UP_BOX globally
Thx

One solution is to derive a class from a widget sort frequently used in your GUI and to set the box type of
this class to FL_THIN_UP_BOX. Then, all widgets of this class wil have the desired thin up box.
If you use frequently several widgets sorts (e.g., Fl_Light_Button, Fl_Radio_Button), you would define one
derived class for each of them.

//
// Hello, World! program for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2021 by Bill Spitzak and others.

#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

class myThinBox : public Fl_Box {
public:
  myThinBox(int x, int y, int w, int h, const char *label) : Fl_Box(x, y, w, h, label) {
    box(FL_THIN_UP_BOX);
  }
};

int main(int argc, char **argv) {
  Fl_Window *window = new Fl_Window(340, 180);
  myThinBox *box = new myThinBox(20, 40, 300, 100, "Hello, World!");
  // you can create hundreds of myThinBox objects, they will all
  // inherit the FL_THIN_UP_BOX property
  box->labelfont(FL_BOLD + FL_ITALIC);
  box->labelsize(36);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  window->show(argc, argv);
  return Fl::run();
}

--
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/45f01be5-ecd7-41a7-b6b0-b19206c43514n%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

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