On Mon, Oct 20, 2014 at 12:26 PM, Philippe Coatmeur <phi...@gnu.org> wrote: > > Now for the direct questions: > > - Is it a proper NTK widget class declaration, that would expose a > value() method? > - Are those proper NTK widget class instances? > > You must derive from an NTK widget in order for it to work properly. See (pseudo) code:
// derive from slider, to provide // - value() : to get the current value // - value(float newVal) : to set a new value // - redraw() will cause the widget to get repainted at the next opportunity. class MyWidget : public Fl_Slider { public: MyWidget( int, int, int, int, const char* ) : Fl_Slider( ... blah blah ... ) { // set default value: value( 0.5 ); } void draw() { // draw stuff based on value() here line_to( 0, width * value() ); } // note: there's no *explicit* value() function here, it's inherited from Fl_Slider. }; class NtkLv2UI { public: NtkLv2UI() { wid = new MyWidget( 10, 10, 200, 25 ); } MyWidget wid; }; NtkLv2UI::port_event() { if ( portNumber == VOLUME ) { wid->value( portValue ); wid->redraw(); } } Hope that clears things up somewhat, -Harry PS: Hermann, FLTK / NTK will delete child instances when a window is deleted. The window itself should be deleted though! -- http://www.openavproductions.com
_______________________________________________ Linux-audio-dev mailing list Linux-audio-dev@lists.linuxaudio.org http://lists.linuxaudio.org/listinfo/linux-audio-dev