Hello,
I have two windows, windowA and windowB, and a third one, toolWindow, which
is non-modal and shall act as follows:
If windowA gets the focus (by user click), toolWindow becomes non-modal in
respect to windowA, if windowB gets the focus, toolWindow becomes non-modal
in respect to windowB, i.e. the non-modal toolWindow shall change
its "parent" or "host".
To archieve this, it seems to be necessary not only to make the new host
window to the "first window" by Fl::first_window(...) and to call
toolWindow->show() after it, but also to hide() the toolWindow before, if
it was already shown.
This works so far, but has the disadvantage, that if a user clicks the first
time on a new host window, the toolWindow becomes the raised window
(highlighted by the WM) instead of (what a user would expect) the clicked
window.
So my questions: Is there a way to make an already shown window
to the raised window? (A simple show() does not have this effect.)
Or is there a better approach for the whole thing?
It follows a scetch of the code. If wished I can post a complete example.
Thanks
Hartmut
class HostWindow;
class ToolWindow : public Fl_Window {
HostWindow * host_;
public:
HostWindow * host() { return host_; }
void host( HostWindow * w ) { host_ = w; }
//...
};
class HostWindow : public Fl_Window
{
static ToolWindow * tool_;
void createToolWindow()
{
tool_ = ...;
tool_->host( this );
}
void doToolWindow()
{
if( !tool_ ) createToolWindow();
if( tool_->host() != this ) { // change of host needed
Fl::first_window( this );
tool_->host( this );
tool_->hide();
}
tool_->show();
}
protected:
int handle( int event )
{
int retcode = Fl_Window::handle( event );
switch( event )
{
case FL_FOCUS:
doToolWindow();
retcode = 1;
}
return retcode;
}
//....
};
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk