> 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 >
Well, it seems that my mind had been so overloaded (which happens when I get through a long list of hurdles) that not only did I forget about the presence of the sources (I kind of compiled them hehe) but also completely forgot debugging the returned widget/value from Widget::goto_focus() oO ! I just presumed I would get a widget no matter what ! Anyway, goto_focus() returned NULL so that's fixed and no crashes there anymore. FYI I had freezed the gui class with FLTK 2 as back-end and started reimplementing one with Win32 as back-end instead (I'm on windows for the moment). Regarding other devs that previously recommended v1.3. Well I did try compiling it initially but failed miserably. I don't remember what it was, but I did some tweaks somwhere (again, don't know what) and got it to get farther in the compilation process, but got to a point where I ran out of "ideas" (patience and energy) and downloaded the 2.0 sources and a single make compiled and linked with no hassle whatsoever. _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

