|
Noticed in TabGroup in executables. We need an easy way to disable square dotted lines are on focused widgets. It's not always appropriate though they look nice enough to put on every button whether it has focus or not at times. Can we do both? But the most important thing is can we disable it on a per-widget basis. In fluid, we can change the selected color to get a much better effect, especially for things like TabGroup widgets. For example with a tab widget with 'color' set to match the window background and 'selected' set to a slightly lighter color, if background is 0xEEEEEE00 or something like that, the square highlight box contrasts poorly with the default triangular shaped tabs. Screenshots. [hope I remember to include them.] BEFORE ![]() Pretty icky, eh? In UpBox.cxx we see the note around line 42. // Maybe this should be a public fltk method? void drawFocusRect(const fltk::Rectangle& r1) { Not public, but it should be possible to disable it on a per-widget basis. UpBox.cxx has a misleading name, by the way, because it contains all kinds of box drawing functions including the problematic focus box drawing routine. The comments near the top got it right. // Box drawing code for the Fast Light Tool Kit (FLTK). That should be reflected in the name as well. (Don't rely on Doxygen to iron out these connections. We don't all use Doxygen docs cuz you miss way too much detail.) Okay, who calls this drawFocusRect() code. You use Doxygen and I'll use other methods. I'm starting at T = 11:35 am. Ready, set... It's now 11:37. I had to stop for a smoke... it's called once by one function in the entire system Symbol::draw_symbol_overlay, which is ALSO in the poorly named "UpBox.cxx" file calls it. Try again? Let's go see who uses that function. And if it's already a virtual, we may be in business. Ready set... go... 11 hits. 20 seconds. See why I don't use Doxygen? Well, enough about that. Here's the important part. One of the hits is in Symbol.h. (Big surprise, but you realy just never know... because, after all, the function Symbol::draw... was in UpBox.) Here it is. virtual void draw_symbol_overlay(const Rectangle&) const; And it IS a virtual. (You are so hot, fltk!) So... We rewrite the function in our own code removing only the drawFocusRect part and put it into our main file. #include <fltk/Symbol.h> // Symbol #include <fltk/draw.h> // drawflags void fltk::Symbol::draw_symbol_overlay(const fltk::Rectangle& r1) const { if (!drawflags(FOCUSED)) return; fltk::Rectangle r(r1); inset(r); if (r.w() > 12) {r.move_x(1); r.move_r(-1);} else if (r.w() <= 3) return; if (r.h() > 15) {r.move_y(1); r.move_b(-1);} else if (r.h() <= 3) return; // drawFocusRect(r); } AFTER ![]() Nice, no? This probably kills the focus box for everything, though even where I might want it. Two main points I want to emphasize here are these. 1. Doxygen is not a good replacement for sensible file names. It's not even that great for programming at this low level.At least that's what I think at this point. It was already a virtual. I've had to revert to previous code more times than I can count. This is really a very well designed system, but the filenames need a tweek here and there, if you ask me. So... Don't take this terrible news too hard. ;-) You are still the greatest! |
_______________________________________________ fltk-bugs mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk-bugs


