> On Tue, Jun 10, 2008 at 2:39 PM, Greg Ercolano <[EMAIL PROTECTED]> wrote:
> > MacArthur, Ian (SELEX GALILEO, UK) wrote:
> >>> my idea is that i want to have 3 large buttons aligned
> >>> vertically on the left half of a screen, and on the right
> >>> half i want to have an Fl_Help view widget, that changes it
> >>> contents while i mouse-over the buttons. the idea is that the
> >>> user might choose the button that he wants to press depending
> >>> on the right hand side content, and only then press the
> >>> button to start loading some stuff / level / etc.
> >>
> >> I assume you need more info than is readily displayed in a simple
> >> tooltip?
> >
> >        Yes, I've seen this kind of thing the OP describes to avoid
> >        the relatively "distracting" tooltips. Basically a 'status bar'
> >        equivalent for help text.. definitely a bit less distracting,
> >        though always takes up a fixed screen space.
> >
> >        I used this in Shadetree, having seen it used on the old Symbolics
> >        systems. Some 3D programs use this too in place of tooltips, like 
> > Maya.
> >
> >        Should be fine to do that, I figure detecting FL_ENTER/FL_LEAVE
> >        events for the buttons should do the trick. Deriving a class from
> >        the buttons should do the trick.. just pass in the widget pointer
> >        to the main app's text widget as the 'userdata', and it should be
> >        fairly easy.
>
> Here is a bit of code from my fl_teachertool project which might help
>
> class MyButton : public Fl_Button {
> private:
>    char hint[160];
>    Fl_Widget* statusbar;
> public:
>     MyButton(int x, int y, int w, int h, const char* l): Fl_Button(x,
> y, w, h, l) {
>
>         strcpy(hint," ");
>     }
>     void set_hint(Fl_Widget* sb, const char *h) {
>         statusbar = sb;
>         strcpy(hint,h);
>     }
>     int handle(int event) {
>                 int ret = Fl_Button::handle(event);
>         switch (event) {
>             case FL_ENTER:
>                 statusbar->label(hint);
>                 color(FL_BLUE);
>                 redraw();
>                 break;
>
>             case FL_LEAVE:
>                 statusbar->label(" ");
>                 color(FL_WHITE);
>                 redraw();
>                 break;
>         }
>         return (ret);
>     }
> };
>
>
> --
> Robert Arkiletian
> Eric Hamber Secondary, Vancouver, Canada
> Fl_TeacherTool http://www3.telus.net/public/robark/Fl_TeacherTool/
> C++ GUI tutorial http://www3.telus.net/public/robark/
>

Thanks alot for your replies and this code snippet! So subclassing will do it.

but i wish FLTK would natively support mouse over events (i am speaking about 
fluid designer). is there a reason why it does not?
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to