When a wxDialog is closed using the close button, a wxCommandEvent is generated simulating the cancel button being pressed. However, if the wxDialog is converted to a wxPanel and floated using wxAUI, then closing it destroys the wxPanel without the event handler seeming to be called at all (certainly there is no wxCommandEvent).
Is this the correct behaviour? (I appreciate that sending a wxCommandEvent might not be correct for all docked windows). If so, what is the best way to ensure the wxCommandEvent does get sent at least for the wxPanels that I have docked?
Alex
Kirix Support Forums
Closing pane windows, lack of event passed to float window
8 posts
• Page 1 of 1
- abligh
- Registered User
- Posts: 59
- Joined: Sun Jan 01, 2006 2:31 pm
wxAUI's events haven't really been filled out just yet. However, by intercepting the wxEVT_AUI_PANEBUTTON event, you should be able to receive notification about the close button being pressed. Please note this event will be sent to the frame window, not the pane window.
After receiving this event, you should be able to let the close proceed by "Skipping" the event, or prevent it by just processing the event. Naturally, since the event will be fired for every pane window, you'll have to check to make sure it's the one you want to receive notification for.
Hope this helps.
Ben
P.S In the future, we'll fill out the events much more thoroughly
After receiving this event, you should be able to let the close proceed by "Skipping" the event, or prevent it by just processing the event. Naturally, since the event will be fired for every pane window, you'll have to check to make sure it's the one you want to receive notification for.
Hope this helps.
Ben
P.S In the future, we'll fill out the events much more thoroughly
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Ben,
What's the clean way of doing this (currently I am altering a local copy of manager.cpp which doesn't seem nice)? As you say, were it sent to the child pane and propagated up, this would be easier, but I think the (floating) frame of the pane is essentially private to manager.cpp isn't it? (IE I don't think I can use the main frame class).
I think this is going to be a general requirement as people want want to do "Save Changes Before Closing" boxes etc.
What I'm currently doing is sending a wxCOMMAND event with wxID cancel to the pane window (by modifying manager.cpp). This is great, except (after doing its clearup), my app then does a Destroy() on the pane window (quite allowably), which seems to confuse wxAUI. I'll see if I can fix it & send you some code if you are interested.
Alex
bwilliams wrote:wxAUI's events haven't really been filled out just yet. However, by intercepting the wxEVT_AUI_PANEBUTTON event, you should be able to receive notification about the close button being pressed. Please note this
What's the clean way of doing this (currently I am altering a local copy of manager.cpp which doesn't seem nice)? As you say, were it sent to the child pane and propagated up, this would be easier, but I think the (floating) frame of the pane is essentially private to manager.cpp isn't it? (IE I don't think I can use the main frame class).
I think this is going to be a general requirement as people want want to do "Save Changes Before Closing" boxes etc.
What I'm currently doing is sending a wxCOMMAND event with wxID cancel to the pane window (by modifying manager.cpp). This is great, except (after doing its clearup), my app then does a Destroy() on the pane window (quite allowably), which seems to confuse wxAUI. I'll see if I can fix it & send you some code if you are interested.
Alex
- abligh
- Registered User
- Posts: 59
- Joined: Sun Jan 01, 2006 2:31 pm
Ben,
(with apologies for multiple messages).
How, in the normal course of events, does the pane get removed from the m_panes list of associated panes when the floating pane is closed by pressing the close button? Or indeed how does the floating wxWindow get destroyed? DetachPane never seems to get called. Am I missing something here? (probably)
Alex
(with apologies for multiple messages).
How, in the normal course of events, does the pane get removed from the m_panes list of associated panes when the floating pane is closed by pressing the close button? Or indeed how does the floating wxWindow get destroyed? DetachPane never seems to get called. Am I missing something here? (probably)
Alex
- abligh
- Registered User
- Posts: 59
- Joined: Sun Jan 01, 2006 2:31 pm
Hi Alex,
There is a pane state called optionDestroyOnClose. Unfortunately, I didn't have time to implement it. I'll try to get that done before wxAUI 0.9.2 is released.
As it stands right now, when the close button is clicked, the wxEVT_AUI_PANEBUTTON is fired to the owner frame (not the pane window). If not intercepted, the wxFrameManager class will handle this event itself and cause the pane simply to no longer be managed. If it was floating, it will be reparented to the frame, and if not, no further action will be taken with the pane (i.e. upon further Updates(), it will be disregarded).
All the best,
Ben
There is a pane state called optionDestroyOnClose. Unfortunately, I didn't have time to implement it. I'll try to get that done before wxAUI 0.9.2 is released.
As it stands right now, when the close button is clicked, the wxEVT_AUI_PANEBUTTON is fired to the owner frame (not the pane window). If not intercepted, the wxFrameManager class will handle this event itself and cause the pane simply to no longer be managed. If it was floating, it will be reparented to the frame, and if not, no further action will be taken with the pane (i.e. upon further Updates(), it will be disregarded).
All the best,
Ben
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
Re: Closing pane windows, lack of event passed to float wind
http://www.kirix.com/en/community/forum ... c.php?t=48 I have contributed a patch for that eventabligh wrote:When a wxDialog is closed using the close button, a wxCommandEvent is generated simulating the cancel button being pressed. However, if the wxDialog is converted to a wxPanel and floated using wxAUI, then closing it destroys the wxPanel without the event handler seeming to be called at all (certainly there is no wxCommandEvent).
Is this the correct behaviour? (I appreciate that sending a wxCommandEvent might not be correct for all docked windows). If so, what is the best way to ensure the wxCommandEvent does get sent at least for the wxPanels that I have docked?
Alex
Joel's Place
Project Administrator for the UPX GUI and developer for wxDev-C++
I want a legal copy of VS Professional!
Project Administrator for the UPX GUI and developer for wxDev-C++
I want a legal copy of VS Professional!
- Joel
- Registered User
- Posts: 37
- Joined: Mon Jan 09, 2006 1:32 pm
- Location: Singapore
OK. So you are sending the event to the main frame window, rather than to the pane window? I don't care much which of these is done (so long as I get a pointer to the pane window if the former is the case).
At the moment, the only event is sent to the floating frame (as opposed to the main frame) which it seems to me is near impossible to intercept as it's window pointer is unknown outside manager.cpp (I could look for the pane's parent, but I'd have to keep track of whenever it was docked and undocked).
Alex
At the moment, the only event is sent to the floating frame (as opposed to the main frame) which it seems to me is near impossible to intercept as it's window pointer is unknown outside manager.cpp (I could look for the pane's parent, but I'd have to keep track of whenever it was docked and undocked).
Alex
- abligh
- Registered User
- Posts: 59
- Joined: Sun Jan 01, 2006 2:31 pm
At present, floating frame close events don't send any event at all. The only event that is implemented as of wxAUI 0.9.1 is the wxEVT_AUI_PANEBUTTON event. This event is just there as a pattern for all the major upcoming events. They all need to be filled out yet.
This events portion of wxAUI is still quite unfinished-- I'll try to find some time to finish it soon.
This events portion of wxAUI is still quite unfinished-- I'll try to find some time to finish it soon.
-
Ben - Kirix Support Team
- Posts: 525
- Joined: Mon Dec 19, 2005 6:29 am
8 posts
· Page 1 of 1
Return to wxAUI Questions, Thoughts & Feedback