Greg, I like that a lot, thanks.

However, I'm perplexed by something. I left your POC calendar
alone and did the following.  Now the calendar doesn't appear!
I'm still scratching my head ... any ideas?

Stan

///////////////////////////////////////////////////////////////
class DateInput : public Fl_Group {
public:
  DateInput(int x, int y, int w, int h, char const* label = 0)
    : Fl_Group(x, y, w, h)
  {
     btn_ = new Fl_Button(x + w - h, y, h, h, "@->");
     btn_->callback(cal_cb, this);
     display_ = new Fl_Output(x, y, w - h, h, label);
     end();
     if(!calendar_) {
       calendar_ = new Calendar(300, 300);
     }
   }
private:
  static Calendar* calendar_;
  Fl_Button* btn_;
  Fl_Output* display_;

  static void cal_cb(Fl_Widget*, void* self)
  {
    DateInput* di = static_cast<DateInput*>(self);
    di->cal();
  }
  void cal()
  {
    calendar_->position(Fl::event_x_root()-4, Fl::event_y_root()-4);
    calendar_->show();
  }
};

Calendar* DateInput::calendar_ = 0;

int main()
{
  Fl_Double_Window win(300, 300);
  new DateInput(50, 50, 100, 20, "Date");
  win.end();
  win.show();
  return Fl::run();
}
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to