Hello,
I have problem how can i close active or selected tabpage in CL editor.
In my plugin i am using for add new page this: m_mgr->AddEditorPage(.....);
Now i need by right click mouse button close it, but i dont know how can i get the name for active page...
This is working:
//wxString projectName = m_mgr->GetWorkspace()->GetActiveProjectName();
//wxString closePage = wxT(projectName); - tabpage is created with the same name like active project.
//m_mgr->ClosePage(closePage); - the tabpage is correctly closed.
How can i close it without this know this name? Can i close active page, which is selected in the CL editor?
I need something like this: m_mgr->ClosePage(m_mgr->GetActivePage()->GetName());
thx.
vsfai.
close active tabpage
-
- CodeLite Enthusiast
- Posts: 11
- Joined: Tue Jan 10, 2012 11:50 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: close active tabpage
You can achieve this by simply sending an event to the main frame let it know that you want to close the active tab
Eran
Code: Select all
wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, XRCID("close_file"));
wxTheApp->GetTopWindow()->GetEventHandler()->AddPendingEvent(evt);
Make sure you have read the HOW TO POST thread
-
- CodeLite Enthusiast
- Posts: 11
- Joined: Tue Jan 10, 2012 11:50 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: close active tabpage
thank you, works well
#include <wx/xrc/xmlres.h>
wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, XRCID("close_file"));
m_mgr->GetTheApp()->GetTopWindow()->GetEventHandler()->AddPendingEvent(evt);
#include <wx/xrc/xmlres.h>
wxCommandEvent evt(wxEVT_COMMAND_MENU_SELECTED, XRCID("close_file"));
m_mgr->GetTheApp()->GetTopWindow()->GetEventHandler()->AddPendingEvent(evt);
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: close active tabpage
No problem.vsfai wrote:thank you, works well
FYI: using this approach, you can emulate every menu item from your plugin
Eran
Make sure you have read the HOW TO POST thread