Hello, how can the callback from a button in one tab group access the values of widgets in other tab groups in addition to its own? In other words, I want to be able to press a button in tab1 and have it go to a callback function that accesses the values of input widgets from both tab1 and tab2.
For accessing the values of all the widgets on the same tab from which the callback button is pressed, I am using the following type of expressions in the callback function:
Found it. The FLTK conventions do not work as conveniently as I would have liked for what ever reason. For example, it would have been nice to be able to write the following expressions where the first line accesses the first widget of tab1, or whatever tab in which the callback button was pressed, and the second line accesses the first widget of tab2:
Fl_Input *v1 = (Fl_Input*)o->parent()->child(0); //arrive at first widget of local tab group
However, the reality is that, while the first line works fine, the second line does not. This seems to be the case because, while you can move several parents up in a single expression, you can only move one child down per expression. Consequently, you have to write the second expression as two expressions as follows, where the first expression can only get as far as indexing the tab2 group, consequently cast as an Fl_Group instead of input on the initial *o pointer of the callback function, and the second expression builds on the previous expression's pointer by casting it as a new Fl_Input pointer since that is the final type of widget that it points to in this case, which then lets you access the next child level down:
Fl_Group *tab2 = (Fl_Group*)o->parent()->parent->child(1); //arrive at tab2
Fl_Input *v2 = (Fl_Input*)tab2->child(0); //arrive at the first widget of tab2
So there it is. The FLTK conventions make a small little hiccup in the code, but it can be done.