focus problem in AuiNotebook tab

Hello all,

Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
wx.version() = '2.8.4.0 (gtk2-unicode)'

I've got a question about focus for which i couldn't find an answer on the mailing list.

I've got the main wx.Frame, in it a tab in an AuiNotebook. When i open a wx.Panel inside the tab i can choose to drag the wx.Panel such that it attaches to the tab. (do you know what i mean?)

However, when i DON'T attach the inner wx.Panel object to the tab, i have a problem with focus.

I've programmed the main wx.Frame to respond to certain events, and this works. But when i have a panel IN FOCUS open inside my AuiNotebook tab, and this panel IS NOT attached to the tab, my main wx.Frame does not respond to the events like it does when the inner wx.Panel IS attached to the tab.

In fact, my main wx.Frame does not respond to any events at all until i manually give it focus by clicking on it with the mouse.

Now, i would like to give the main wx.Frame its focus back whenever an event occurs to which it should respond.

The best i could come up with is to have a dispatcher signal received by the main wx.Frame and to run a "self.SetFocus()" in response. However, nothing happens.

Again, when i DO attach the inner wx.Panel to the AuiNotebook tab, the main wx.Frame responds perfectly.

Does this make any sense?
Does anyone recognize this problem, or something like it?
How can i give the focus to the main wx.Frame in this case?

many thanks for your time,

yours
Maarten

···

--
NeoNova BV, The Netherlands
Professional internet and VoIP solutions

http://www.neonova.nl Kruislaan 419 1098 VA Amsterdam
info: 020-5628292 servicedesk: 020-5628292 fax: 020-5628291

The following disclamer applies to this email:
http://www.neonova.nl/maildisclaimer

Hi Maarten,

···

2008/8/6 Maarten Stol <maarten.stol@neonova.nl>:

Hello all,

I've got a question about focus for which i couldn't find an answer on the
mailing list.

I've got the main wx.Frame, in it a tab in an AuiNotebook. When i open a
wx.Panel inside the tab i can choose to drag the wx.Panel such that it
attaches to the tab. (do you know what i mean?)

Maybe it's just me, but I don't understand what you mean with 'open a
wx.Panel inside the tab'. Can you explain that a bit more? Also, what
does it mean when you say 'drag the wx.Panel such that it attaches to
the tab'? The only thing you can drag in an AUI Notebook are tabs.

BTW, when you are creating the wx.Panel, what are you providing as its parent?

Cheers, Frank

Maarten Stol wrote:

Hello all,

Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
wx.version() = '2.8.4.0 (gtk2-unicode)'

I've got a question about focus for which i couldn't find an answer on the mailing list.

I've got the main wx.Frame, in it a tab in an AuiNotebook. When i open a wx.Panel inside the tab i can choose to drag the wx.Panel such that it attaches to the tab. (do you know what i mean?)

However, when i DON'T attach the inner wx.Panel object to the tab, i have a problem with focus.

I've programmed the main wx.Frame to respond to certain events, and this works. But when i have a panel IN FOCUS open inside my AuiNotebook tab, and this panel IS NOT attached to the tab, my main wx.Frame does not respond to the events like it does when the inner wx.Panel IS attached to the tab.

In fact, my main wx.Frame does not respond to any events at all until i manually give it focus by clicking on it with the mouse.

Now, i would like to give the main wx.Frame its focus back whenever an event occurs to which it should respond.

The best i could come up with is to have a dispatcher signal received by the main wx.Frame and to run a "self.SetFocus()" in response. However, nothing happens.

Again, when i DO attach the inner wx.Panel to the AuiNotebook tab, the main wx.Frame responds perfectly.

Does this make any sense?

No. Please make a small runnable sample that shows the problem and step by step instructions for reproducing it if it's not obvious.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Maarten Stol wrote:

Does this make any sense?

No. Please make a small runnable sample that shows the problem and step by step instructions for reproducing it if it's not obvious.

I would have loved to. That is, however, easier said than done. The code I'm working on is (for my standards) large and complex. I'm currently trying to reduce the problem to a small code sample, but having difficulty doing so successfully.

I'll let you know as soon as I have something to work with.

Maarten

···

--
NeoNova BV, The Netherlands
Professional internet and VoIP solutions

http://www.neonova.nl Kruislaan 419 1098 VA Amsterdam
info: 020-5628292 servicedesk: 020-5628292 fax: 020-5628291

The following disclamer applies to this email:
http://www.neonova.nl/maildisclaimer

Frank Niessink wrote:

Hi Maarten,

Hello all,

I've got a question about focus for which i couldn't find an answer on the
mailing list.

I've got the main wx.Frame, in it a tab in an AuiNotebook. When i open a
wx.Panel inside the tab i can choose to drag the wx.Panel such that it
attaches to the tab. (do you know what i mean?)

Maybe it's just me, but I don't understand what you mean with 'open a
wx.Panel inside the tab'. Can you explain that a bit more? Also, what
does it mean when you say 'drag the wx.Panel such that it attaches to
the tab'? The only thing you can drag in an AUI Notebook are tabs.

BTW, when you are creating the wx.Panel, what are you providing as its parent?

Cheers, Frank

Hi Frank,

this maybe a problem of terminology. Also, I've never worked with the auiNotebook before, so I've got no clear idea how things should look or what to call them. (sorry :frowning: )

I can open multiple 'tabs' in my app. I can then open a number of smaller windows that live inside these 'tabs'. However, when I open such a smaller window (a wx.Panel) it hovers over my app. I can even move it outside the app and onto the desktop. When i change tabs at this moment, the smaller window is not affected and stays in view.

I can then choose to let it hover there, or choose to attach it to a tab by dragging the smaller window against the side of the tab. When I do that, the tab 'grabs' the smaller window.

When I change tabs at this moment, the smaller window disappears from view since it now lives exclusively in the tab I attached it to. (which was its parent in the first place. It does not seem possible to attach a panel to a tab that is not the panel's parent)

My focus problem arises at the time the smaller window hovers over my app, and is not yet attached to any tab. i could either:

1) try to attach the panel to the tab as soon as it is created. The panels parent is one particular tab, so there is no sense in letting it hover over the whole app anyway.

2) or move the focus to the mainframe as soon as events occur that require the mainframe to handle them.

I've had no success with either yet.

I have not had time yet to provide you with a small code sample, but will do so as soon as I succeed in making one. Reducing the code base I'm working on is difficult and may take more time than to solve the problem in the first place. But I may be able to reproduce the problem from scratch.

thank you for your time.
Yours
Maarten

···

2008/8/6 Maarten Stol <maarten.stol@neonova.nl>:

--
NeoNova BV, The Netherlands
Professional internet and VoIP solutions

http://www.neonova.nl Kruislaan 419 1098 VA Amsterdam
info: 020-5628292 servicedesk: 020-5628292 fax: 020-5628291

The following disclamer applies to this email:
http://www.neonova.nl/maildisclaimer

Hi Maarten,

this maybe a problem of terminology. Also, I've never worked with the
auiNotebook before, so I've got no clear idea how things should look or what
to call them. (sorry :frowning: )

But from what you're telling below it sounds as if you are not only
using a AUINotebook, but also AUI Managed Frames, is that correct?

I can open multiple 'tabs' in my app. I can then open a number of smaller
windows that live inside these 'tabs'. However, when I open such a smaller
window (a wx.Panel) it hovers over my app. I can even move it outside the
app and onto the desktop. When i change tabs at this moment, the smaller
window is not affected and stays in view.

Again, this sounds if you're using both an AUINotebook and AUI Managed Frames.

I can then choose to let it hover there, or choose to attach it to a tab by
dragging the smaller window against the side of the tab. When I do that, the
tab 'grabs' the smaller window.

Are the windows in a tab managed by an AuiManager? Has each tab its
own AuiManager? (Must be, I don't think you can have one AuiManager
managing windows in different tabs at the same time).

When I change tabs at this moment, the smaller window disappears from view
since it now lives exclusively in the tab I attached it to. (which was its
parent in the first place. It does not seem possible to attach a panel to a
tab that is not the panel's parent)

You might be able to reparent the window to a panel in a different
tab, using frame.Reparent(newParent).

My focus problem arises at the time the smaller window hovers over my app,
and is not yet attached to any tab.

But this is not what you said in your first mail, there you said: "But
when i have a panel IN FOCUS open inside my AuiNotebook tab, and this
panel IS NOT attached to the tab, my main wx.Frame does not respond to
the events like it does when the inner wx.Panel IS attached to the
tab."

Now you're saying the problem occurs when the window is floating, but
in your first mail you said it occurs when the window (panel) is
docked.

While you're working on that SmallRunnableApp, it might help if you
sketch the structure of your user interface, i.e. something like (just
guessing):

wx.Frame
... wx.aui.AuiNotebook
...... wx.Panel, managed by AuiManager (repeated each page)
etc.

Cheers, Frank

···

2008/8/7 Maarten Stol <maarten.stol@neonova.nl>: