Article #1102: flPlug 0.1.1

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

Return to Articles | Show Comments | Submit Comment ]

Article #1102: flPlug 0.1.1

Created at 05:47 Aug 26, 2011 by diegoefe

Minimal flPlug example:

#include <FL/Fl.H> #include <FL/Fl_Double_Window.H> #include <FL/Fl_Button.H> #include <FL/fl_ask.H> #include "flPlug.h" // include definitions

// My window class MyWin
        : public Fl_Double_Window,
          public fl::Plugger<MyWin> { public:
        MyWin(int _x, int _y, int _w, int _h, const char* _l=0) : Fl_Double_Window(_x, _y, _w, _h, _l)
        {
                Fl_Button*
b=new Fl_Button(5,5,_w-10,_h-10, "Push me!");
                add(b);
                // connect the callback
                plug(b, &MyWin::push);
                end();
        } private:
        // calback can be private
        void push() { fl_alert("Pushed!"); } };

int main() {
        MyWin w(50,50,200, 50, "Simple Test");
        w.show();
        return Fl::run(); }

Download | Home Page | Listing ]


Comments

Submit Comment ]
 
 

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