On 29/05/11 12:07, anon wrote: > As for FLTK 2, I've not come up with a way to detect whether the widget > returned by Browser::goto_focus() is an actual Item or not. The reason being > that Widget::label() causes a crash when called on a widget of non-Item type > (at least on whatever widget it is that is the target of clicks when clicking > outside of items in a (File)Browser and hence deselecting any selected item). > I know there is Widget::type() but it seems to return zero (just like > Buttons, for example). As a random aside, the irony in this email is that I'm working on fltk::Browser's documentation as I read this...
Anyway, what goto_focus() does is simply move HERE (the "current" Mark) to FOCUS (the Mark with the focus). It then calls Menu::item(child(indexes, level)), which searches the List for the right node and then *sets* it (or NULL) if it doesn't exist and then returns it through item(). You can't thus call it on a non-Item data type, I don't think. Since goto_focus() could theoretically return NULL if no Browser item has the focus, I'd suggest you try testing for the NULL case before accessing Widget::label(), as this is what's probably causing the issue. If you could post a really really small, compilable example that exacerbates the problem, I'll probably be able to take a more in-depth look at it.... HTH, Ben _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

