24.03.2007 matthiasm <[EMAIL PROTECTED]> wrote:
>
> On Mar 24, 2007, at 6:49 PM, Milan wrote:
>
> > When I type the first character in input box, child window with
> > browser in it,
> > which added that character, pops up but focus is not on input
> > anymore, so I
> > have to click on input and continue typing after which focus stays
> > on input.
>
> Hmm, I have not tried this yet, but shooting from the hip, Id suggest
> you make your browser either a regular window and call set_non_modal
> () on it, or make it an Fl_Menu_Window(). That way, it will stay on
> top of your window. Next, I'd call take_focus(). If that is not
> enough, you could try calling myInput->window()->show() before
> calling take_focus(), so your window becomes the first n the window
> list. Please let me know if this worked for you. If not, I'll see if
> I find a better way.
>
> BTW: which OS are you using?
Although I'm a beginner with FLTK I think that making browserWindow
MenuWindow isn't what it should be (I'll explain shortly after). I've tried
calling wordInput->window()->show() and after that take_focus() and
wordInput->take_focus() but still, the first typed character makes input loses
its focus, and after I manually focus it again I can continue typing
continuously without input loosing focus again, like the first time.
Browser window is actually a window (fltk::Window) for which, in MainWindow
constructor (which is a subclass of fltk::Window), I called
browserWindow->child_of(this) That window is borderless i.e. I called
browserWinow->border(false) and it contains only fltk::Browser which occupies
all of that window space.
This is code snippets about the problem:
--- Start ---
class MainWindow : public Window {
public:
MainWindow(int w, int h, const char *ime, int argc, char
**argv);
// ...
Input *wordInput;
Window *browserWindow;
Browser *browser;
// ...
};
MainWindow::MainWindow(int w, int h, const char *ime, int argc, char **argv):
Window(w, h, ime) {
begin();
// ...
browserWindow = new Window(BROWSER_WND_WIDTH,
BROWSER_WND_HEIGHT);
browserWindow->begin();
browser = new Browser(BROWSER_X_POS, BROWSER_Y_POS,
BROWSER_WIDTH, BROWSER_HEIGHT);
browser->column_labels(BROWSER_LABELS);
browser->column_widths(BROWSER_COL_WIDTHS);
browser->deselect(); // so it wont select some item
browserWindow->end();
browserWindow->border(false);
browserWindow->set_non_modal();
end();
// ...
callback(cb_mainWindow);
show(argc, argv);
browserWindow->child_of(this);
}
// ...
void MainWindow::cb_wordInput_i() { // callback for wordInput
if (wordInput->size()) {
browser->add(wordInput->value());
browserWindow->show();
wordInput->window()->show();
take_focus();
wordInput->take_focus();
} else {
browser->clear();
browserWindow->hide();
}
}
// ...
--- End ---
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk