> I tried the valuators demo and Fl::visible_focus/clear_visible_focus
> too, but I didn't solve the problem.
>
> When I try to give the widget focus by keyboard actions the widget take
> the focus, but when I try to give focus by mouse clicking the widget
> doesn't take the focus.
>
> By keyboard actions I could move focus from the first one slider to the
> second one and so on. But when I give the focus to the last one slider
> the focus stop to move and doesn't come back.
This all sounds very odd - attached below is a simple fluid file that I think
demonstrates:
- you can click a widget with the mouse, it takes the focus
- you can move the sliders using the up/down keys
- you can keyboard navigate from slider to slider. When the navigation reaches
the last widget (the Exit button in this case) it wraps back to the first
widget.
I think that is all the problems you report? It seems to be working OK in this
example.
What version of fltk are you using? Maybe there is something that is already
fixed (if you are still using an older version of fltk, that is.)
> Is there a method to change the color to focused widget?
> I tried to include some instructions about the color in the callback,
> but the color changing doesn't work.
This is a separate problem, really. The easiest way to do this is probably to
make your own widget, subclassed from Fl_Slider or similar, and in the handle
method change the widget colour for FL_ENTER and FL_LEAVE events.
-------------- code example - fluid file -----------
# data file for the Fltk User Interface Designer (fluid)
version 1.0109
header_name {.h}
code_name {.cxx}
Function {} {open
} {
Fl_Window main_win {
label {Slider Test Window} open
private xywh {530 226 600 320} type Double visible
} {
Fl_Slider slider1 {
label {Chan 1}
xywh {25 24 48 251} type {Vert Knob} selection_color 4
}
Fl_Slider slider2 {
label {Chan 2}
xywh {151 24 48 251} type {Vert Knob} selection_color 4
}
Fl_Slider slider3 {
label {Chan 3}
xywh {278 24 48 251} type {Vert Knob} selection_color 4
}
Fl_Slider slider4 {
label {Chan 4}
xywh {405 24 48 251} type {Vert Knob} selection_color 4
}
Fl_Button exit_bt {
label Exit
callback {// exit button
main_win->hide();
// end of cb} selected
private xywh {500 256 70 29} box THIN_UP_BOX
}
}
}
---- end of file -----
--
Ian
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk