Tool Window and Focus

  • Thread starter Thread starter Johnny Jörgensen
  • Start date Start date
J

Johnny Jörgensen

I've a form that opens a tool window. The problem is that when the tool
window is opened, the main form itself passes focus to the toolwindow.

What I want and need is a toolwindow that works like a control with
tabstop=false, i.e. it doesn't get focus when the window is opened, but
focus is retained at the main form. And when you click a button on the
toolwindow, it processes the click event and returns focus to the main form.

Is that possible?

Cheers,
Johnny J.
 
You could set the focus back to the main form after you show the tool bar.

Form myToolBar = new Form();
myToolBar.Show();
this.Focus(); // focus back to the main form

Adrian.
 
Tried that, but it doesn't work.

It goes into an endless loop somehow...

/Johnny J.



Adrian Voicu said:
You could set the focus back to the main form after you show the tool bar.

Form myToolBar = new Form();
myToolBar.Show();
this.Focus(); // focus back to the main form

Adrian.
--
[Please mark my answer if it was helpful to you]




Johnny Jörgensen said:
I've a form that opens a tool window. The problem is that when the tool
window is opened, the main form itself passes focus to the toolwindow.

What I want and need is a toolwindow that works like a control with
tabstop=false, i.e. it doesn't get focus when the window is opened, but
focus is retained at the main form. And when you click a button on the
toolwindow, it processes the click event and returns focus to the main
form.

Is that possible?

Cheers,
Johnny J.
 
When does it go into an endless loop? Can you describe what is happening?

Adrian.
--
[Please mark my answer if it was helpful to you]




Johnny Jörgensen said:
Tried that, but it doesn't work.

It goes into an endless loop somehow...

/Johnny J.



Adrian Voicu said:
You could set the focus back to the main form after you show the tool bar.

Form myToolBar = new Form();
myToolBar.Show();
this.Focus(); // focus back to the main form

Adrian.
--
[Please mark my answer if it was helpful to you]




Johnny Jörgensen said:
I've a form that opens a tool window. The problem is that when the tool
window is opened, the main form itself passes focus to the toolwindow.

What I want and need is a toolwindow that works like a control with
tabstop=false, i.e. it doesn't get focus when the window is opened, but
focus is retained at the main form. And when you click a button on the
toolwindow, it processes the click event and returns focus to the main
form.

Is that possible?

Cheers,
Johnny J.
 
Back
Top