Similar Threads:
1.mdi in mdi in mdi - 2.6.2
Hi,
i need a nother mdi layer! My Mainframe is derived from mdiParentFrame.
It contains a mdiChildFrame child1.
Now i want to be this child another mdi parent! But i cant figure out how.
If i just want to add a mdiChildFrame child2 to child1.
Is this even possible?
it complains while when i want to create child2 (cannont convert form
childframe* to parentfrafe*)
make the chil1 a mdiParentFrame didnt work either?
regards, Tobi
---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM
2.MDI, XRC, and MSW
I've modified the XRC demo to use MDI for the main frame and a couple
of the child frames (diffs follow). Once I figured out how to fire
the handlers for MDI frames (wxResourceHandler::LoadObject() isn't in
the manual, BTW), it works great on OSX and Debian.
M$W is another matter, though. The client window isn't drawn when the
main frame first displays, but if you minimize and then restore it,
it is... but that disables the toolbar.
I tried commenting out just about everything in the constructor, two-
step creation of the main frame, hand-creating (instead of loading
from XRC) the main frame, even making the main frame a global
variable. Obviously, there's something there that I'm missing,
because the MDI sample does work.
Any ideas?
Regards,
John Ralls
--- /usr/local/src/wxMac-2.8.6/samples/xrc/custclas.h 2007-09-25
02:09:59.000000000 -0700
+++ custclas.h 2007-12-26 18:03:41.000000000 -0800
@@ -81,6 +81,16 @@
};
+class CustClassFrame : public wxMDIChildFrame {
+public:
+CustClassFrame() : wxMDIChildFrame() {}
+
+ ~CustClassFrame() {}
+ void OnOK(wxCommandEvent& evt) { Hide(); }
+private:
+ DECLARE_EVENT_TABLE()
+};
+
//--------------------------------------------------------------------
--------------------
// End single inclusion of this .h file condition
//--------------------------------------------------------------------
--------------------
--- /usr/local/src/wxMac-2.8.6/samples/xrc/custclas.cpp 2007-09-25
02:09:59.000000000 -0700
+++ custclas.cpp 2007-12-26 18:03:41.000000000 -0800
@@ -59,6 +59,10 @@
IMPLEMENT_DYNAMIC_CLASS( MyResizableListCtrl, wxListCtrl )
+BEGIN_EVENT_TABLE(CustClassFrame, wxFrame)
+EVT_BUTTON(wxID_OK, CustClassFrame::OnOK)
+END_EVENT_TABLE()
+
//--------------------------------------------------------------------
---------
// Event table: connect the events to the handler functions to
process them
//--------------------------------------------------------------------
---------
--- /usr/local/src/wxMac-2.8.6/samples/xrc/xrcdemo.h 2007-09-25
02:09:59.000000000 -0700
+++ xrcdemo.h 2007-12-26 18:03:41.000000000 -0800
@@ -18,14 +18,19 @@
// Headers
//--------------------------------------------------------------------
---------
-#include "wx/app.h" // wxApp
//--------------------------------------------------------------------
---------
// Class definition: MyApp
//--------------------------------------------------------------------
---------
// Define a new application type, each program should derive a
class from wxApp
+#ifdef SW_USE_WX_APP_GUI_TESTING
+#include <wxGuiTest/swWxGuiTestApp.h>
+class MyApp : public swTst::WxGuiTestApp
+#else
+#include <wx/app.h>
class MyApp : public wxApp
+#endif
{
public:
--- /usr/local/src/wxMac-2.8.6/samples/xrc/xrcdemo.cpp 2007-09-25
02:09:59.000000000 -0700
+++ xrcdemo.cpp 2007-12-26 18:03:41.000000000 -0800
@@ -41,6 +41,9 @@
#include "wx/cshelp.h" // wxSimpleHelpProvider for
helptext
#include "myframe.h"
+#ifdef SW_USE_WX_APP_GUI_TESTING
+#include <wxGuiTest/swWxGuiTestHelper.h>
+#endif
//--------------------------------------------------------------------
---------
// wxWidgets macro: Declare the application.
@@ -120,7 +123,9 @@
// Variable expansion example
if (!wxXmlResource::Get()->Load(wxT("rc/variable.xrc")))
return false;
-
+#ifdef SW_USE_WX_APP_GUI_TESTING
+ wxTheApp->SetAppName(_T("xrcdemo_test"));
+#endif
#if wxUSE_HELP
// Use the simple help provider to show the context-sensitive help
--- /usr/local/src/wxMac-2.8.6/samples/xrc/derivdlg.cpp 2007-09-25
02:09:59.000000000 -0700
+++ derivdlg.cpp 2007-12-29 11:41:51.000000000 -0800
@@ -35,7 +35,7 @@
//--------------------------------------------------------------------
---------
#include "wx/xrc/xmlres.h" // XRC XML resouces
-
+
//--------------------------------------------------------------------
---------
// Event table: connect the events to the handler functions to
process them
//--------------------------------------------------------------------
---------
@@ -100,7 +100,11 @@
if (msgDlg2.ShowModal() == wxID_OK)
{
// ...then end this Preferences dialog.
- EndModal( wxID_OK );
+ #ifdef SW_USE_WX_APP_GUI_TESTING
+ Hide();
+#else
+ EndModal( wxID_OK );
+#endif
// You could also have used event.Skip() which would then
skip up
// to the wxDialog's event table and see if there was a
EVT_BUTTON
// handler for wxID_OK and if there was, then execute that
code.
--- /usr/local/src/wxMac-2.8.6/samples/xrc/myframe.h 2007-09-25
02:09:59.000000000 -0700
+++ myframe.h 2007-12-26 18:03:41.000000000 -0800
@@ -25,7 +25,7 @@
//--------------------------------------------------------------------
---------
// Define a new frame type: this is going to be our main frame
-class MyFrame : public wxFrame
+class MyFrame : public wxMDIParentFrame
{
public:
--- /usr/local/src/wxMac-2.8.6/samples/xrc/myframe.cpp 2007-09-25
02:09:59.000000000 -0700
+++ myframe.cpp 2007-12-29 16:17:12.000000000 -0800
@@ -25,7 +25,9 @@
#endif
#include "wx/sysopt.h"
-
+#ifdef SW_USE_WX_APP_GUI_TESTING
+#include <wxGuiTest/swWxGuiTestHelper.h>
+#endif
//--------------------------------------------------------------------
---------
// Header of this .cpp file
//--------------------------------------------------------------------
---------
@@ -105,7 +107,8 @@
// since this frame will always be the top window, and thus
parentless.
// However, the current approach has source code that can be
recycled
// for other frames that aren't the top level window.]
- wxXmlResource::Get()->LoadFrame(this, parent, wxT("main_frame"));
+ bool success= wxXmlResource::Get()->LoadObject(this, parent, wxT
("main_frame"), _T("wxMDIParentFrame"));
+ wxASSERT_MSG(success, _T("Load of Frame main_frame failed"));
// Set the icon for the frame.
SetIcon(wxICON(appicon));
@@ -172,9 +175,14 @@
// Make an instance of our derived dialog, passing it "this"
window
// (the main frame) as the parent of the dialog. This allows
the dialog
// to be destructed automatically when the parent is destroyed.
- PreferencesDialog preferencesDialog(this);
+ PreferencesDialog* preferencesDialog = new PreferencesDialog(this);
// Show the instance of the dialog, modally.
- preferencesDialog.ShowModal();
+#ifdef SW_USE_WX_APP_GUI_TESTING
+ swTst::WxGuiTestHelper::Show(preferencesDialog, true, true);
+#else
+ preferencesDialog->ShowModal();
+ preferencesDialog->Destroy();
+#endif
}
void MyFrame::OnAnimationCtrlPlay(wxCommandEvent& event)
@@ -249,25 +257,33 @@
#endif
// All done. Show the dialog.
+#ifdef SW_USE_WX_APP_GUI_TESTING
+ swTst::WxGuiTestHelper::Show(&dlg, true, true);
+#else
dlg.ShowModal();
+#endif
}
void MyFrame::OnUncenteredToolOrMenuCommand(wxCommandEvent& WXUNUSED
(event))
{
- wxDialog dlg;
- wxXmlResource::Get()->LoadDialog(&dlg, this, wxT
("uncentered_dialog"));
- dlg.ShowModal();
+ wxDialog* dlg = new wxDialog;
+ wxXmlResource::Get()->LoadDialog(dlg, this, wxT
("uncentered_dialog"));
+#ifdef SW_USE_WX_APP_GUI_TESTING
+ swTst::WxGuiTestHelper::Show(dlg, true, true);
+#else
+ dlg->ShowModal();
+#endif
}
void MyFrame::OnCustomClassToolOrMenuCommand(wxCommandEvent&
WXUNUSED(event))
{
- wxDialog dlg;
- wxXmlResource::Get()->LoadDialog(&dlg, this, wxT
("custom_class_dialog"));
+ CustClassFrame* child = new CustClassFrame;
+ wxXmlResource::Get()->LoadObject(child, this, wxT
("custom_class_child"), _T("wxMDIChildFrame"));
// Make an instance of our new custom class.
- MyResizableListCtrl* a_myResizableListCtrl = new
MyResizableListCtrl(&dlg,
+ MyResizableListCtrl* a_myResizableListCtrl = new
MyResizableListCtrl(child,
wxID_ANY,
wxDefaultPosition,
wxDefaultSize,
@@ -278,23 +294,27 @@
// custctrl.xrc XRC file.
wxXmlResource::Get()->AttachUnknownControl(wxT
("custom_control_placeholder"),
a_myResizableListCtrl);
- dlg.ShowModal();
+ child->Show();
}
void MyFrame::OnPlatformPropertyToolOrMenuCommand(wxCommandEvent&
WXUNUSED(event))
{
- wxDialog dlg;
- wxXmlResource::Get()->LoadDialog(&dlg, this, wxT
("platform_property_dialog"));
- dlg.ShowModal();
+ wxMDIChildFrame* child = new wxMDIChildFrame;
+ wxXmlResource::Get()->LoadObject(child, this, wxT
("platform_child"), wxT("wxMDIChildFrame"));
+ child->Show();
}
void MyFrame::OnArtProviderToolOrMenuCommand(wxCommandEvent&
WXUNUSED(event))
{
- wxDialog dlg;
- wxXmlResource::Get()->LoadDialog(&dlg, this, wxT
("art_provider_dialog"));
- dlg.ShowModal();
+ wxDialog* dlg = new wxDialog;
+ wxXmlResource::Get()->LoadDialog(dlg, this, wxT
("art_provider_dialog"));
+#ifdef SW_USE_WX_APP_GUI_TESTING
+ swTst::WxGuiTestHelper::Show(dlg, true, true);
+#else
+ dlg->ShowModal();
+#endif
}
---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM
3.Newsbie Problems: Havin a Notebook within an MDI Frame
Hi!
Coming from C++Builder, i'm new to wxWidgets (2.5.2). Unfortunatly i don't
get all this sizer stuff and the documentation is not a good help.
I'm fiddling with the MDI example. I want to replace the TextWindow on the
left side with a Notebook containing some buttons. Unfortunatly it never
got aligned the way i want and i don't know how to do it. I used wxGlade as
a reference, but it produces code thats obsolete (wxNotebookSizer), not to
mention that it doesn't work either. Here is my code snippet:
// Define my frame constructor
MyFrame::MyFrame(wxWindow *parent,
const wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
const long style)
: wxMDIParentFrame(parent, id, title, pos, size,
style | wxNO_FULL_REPAINT_ON_RESIZE)
{
//textWindow = new wxTextCtrl(this, wxID_ANY, _T("A help window"),
// wxDefaultPosition, wxDefaultSize,
// wxTE_MULTILINE | wxSUNKEN_BORDER);
notebook_1 = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize,
0);
notebook_1_pane_1 = new wxPanel(notebook_1, -1);
wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL);
notebook_1->AddPage(notebook_1_pane_1, wxT("tab1"));
sizer_1->Add(new wxNotebookSizer(notebook_1), 1, wxEXPAND, 0);
//sizer_1->Add(new wxBoxSizer(wxHORIZONTAL));
sizer_1->Add( new wxButton( this, wxID_OK, "OK" ),
0, // make horizontally unstretchable
wxALL, // make border all around (implicit top alignment)
10 ); // set border width to 10
SetAutoLayout(true);
SetSizer(sizer_1);
//sizer_1->Fit(this);
//sizer_1->SetSizeHints(this);
Layout();
#if wxUSE_TOOLBAR
CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL);
InitToolBar(GetToolBar());
#endif // wxUSE_TOOLBAR
...
This looks horrible. Can anybody help? Thanks in advance.
Cheers
Gunnar
4.MDI w/Notebook problem
Hi all,
I've been following along with the MDI sample included with wxWindows
(mdi.exe) and adapting it for the interface I want to create. On the left
hand side in the sample is a wxTextCtrl box. I liked that idea but needed a
couple of extra controls so I'm trying to change that to wxNotebook.
After changing it to wxNotebook, I compile and run the program but the
Notebook is not appearing. I've added a panel to place the notebook on but
it still isn't appearing.
Any ideas on what is causing the Notebook control to not show up? And why
would it be any different from wxTextCtrl?
Thanks
Jody
5.window menu for mdi based application
Hi all,
I've a problem. I've an application based on wxwidgets and it's MDI. In
its previous version (based on wxwindows 2.2.9) I notice that the window
menu contains a dynamic list with the opened mdi child, in this
version(based on 2.6.3) I see the window menu with the classical item
but not this dynamic list. Does anybody know how to implement it?
thank you
bye
---------------------------------------------------------------------
To unsubscribe, e-mail: XXXX@XXXXX.COM
For additional commands, e-mail: XXXX@XXXXX.COM
6. notebook sample crashes on MSW with wxUSE_STL
7. [MSW 2.6.0] Wrong color of toolbar on notebook page when using xp theme
8. How can I delete the close button on all MDI windows in an MDI app