|
|
I've created a tabbed dialog using fluid and I want to set the focus on an Fl_Input widget when the dialog is shown. But the focus is always set to the 'Ok' button instead.
--------- Here's my layout in fluid:
Prefs_Dlg()
+Double_Window win
+Tabs tabs
+Group tab0
+Input inp
+Group tab1
+Check_Button chk
+Button "&Ok"
+Button "&Cancel"
---------- Fluid-generated header:
class App_Prefs_Dlg {
public:
App_Prefs_Dlg();
Fl_Double_Window *win;
Fl_Tabs *tabs;
Fl_Group *tab0;
Fl_Input *inp;
Fl_Group *tab1;
Fl_Check_Button *chk;
private:
void cb_Ok_i(Fl_Button*, void*);
static void cb_Ok(Fl_Button*, void*);
void cb_Cancel_i(Fl_Button*, void*);
static void cb_Cancel(Fl_Button*, void*);
};
---------- code to show dialog:
Prefs_Dlg *dlg = new Prefs_Dlg()
dlg->win->set_modal();
dlg->win->show();
dlg->inp->take_focus();
dlg->inp->position( strlen( inp->value()), 0 );
-----------
Observed Result: 'Ok' button has the focus
Expected Result: inp widget has the focus, text is selected
What's the best way get the input widget to have the focus when the dialog is first shown? I'm currently using fltk-1.1.x-r4509.
[ Direct Link to Message ] | |
|
| |