How to open new frame from button

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
User avatar
doublemax
Moderator
Moderator
Posts: 14299
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to open new frame from button

Post by doublemax » Sun Jul 28, 2019 9:13 am

According to the chart wxFormBuilder doesn't support wxSimplebook either. I can't think of any comfortable and easy solution when using a GUI editor.

I would create all individual panels and put them all into a vertical wxBoxSizer. Then write some custom code that hides/shows only the panel you want to be visible at the time (which is basically what wxSimplebook does internally).
Use the source, Luke!

marcusbarnet
Experienced Solver
Experienced Solver
Posts: 55
Joined: Sat Jul 27, 2019 3:45 pm

Re: How to open new frame from button

Post by marcusbarnet » Sun Jul 28, 2019 4:14 pm

I was trying to compile the notebook example by using CodeBlocks on Ubuntu.
I imported the project into CodeBlocks by using the import utility and by selecting the visual studio project file.
Everything loaded correctly, but when I try to build the project, I get this error:

Code: Select all

In file included from /usr/include/wx-3.0/wx/chkconf.h:1222,
                 from /usr/include/wx-3.0/wx/platform.h:596,
                 from /usr/include/wx-3.0/wx/defs.h:27,
                 from /usr/include/wx-3.0/wx/wxprec.h:12,
                 from /home/robodyne/Downloads/wxwidgets master/wxWidgets-master/samples/notebook/notebook.cpp:12:
./../../include/wx/msw/chkconf.h:27:10: error: #error "wxUSE_WINRT must be defined."
 #        error "wxUSE_WINRT must be defined."
          ^~~~~
./../../include/wx/msw/chkconf.h:43:9: error: #error "wxUSE_DBGHELP must be defined"
 #       error "wxUSE_DBGHELP must be defined"
         ^~~~~
./../../include/wx/msw/chkconf.h:107:9: error: #error "wxUSE_TASKBARBUTTON must be defined."
 #       error "wxUSE_TASKBARBUTTON must be defined."
         ^~~~~
./../../include/wx/msw/chkconf.h:123:10: error: #error "wxUSE_WINSOCK2 must be defined."
 #        error "wxUSE_WINSOCK2 must be defined."
          ^~~~~
./../../include/wx/msw/chkconf.h:386:13: error: #error "wxUSE_DRAG_AND_DROP requires wxUSE_OLE"
 #           error "wxUSE_DRAG_AND_DROP requires wxUSE_OLE"
             ^~~~~
./../../include/wx/msw/chkconf.h:397:13: error: #error "wxMediaCtl requires wxActiveXContainer"
 #           error "wxMediaCtl requires wxActiveXContainer"
             ^~~~~
In file included from /usr/include/wx-3.0/wx/string.h:45,
                 from /usr/include/wx-3.0/wx/memory.h:15,
                 from /usr/include/wx-3.0/wx/object.h:19,
                 from /usr/include/wx-3.0/wx/wx.h:15,
                 from /home/robodyne/Downloads/wxwidgets master/wxWidgets-master/samples/notebook/notebook.cpp:19:
/usr/include/wx-3.0/wx/wxcrtbase.h:41:14: fatal error: io.h: No such file or directory
     #include <io.h>
              ^~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
7 error(s), 0 warning(s) (0 minute(s), 0 second(s))
I tried to search on google for the first error, but everything is related to Windows.
Does it mean that I cannot build this example on Ubuntu/CodeBlocks?

I think that it would be good for me to study the "notebook" working example.

User avatar
doublemax
Moderator
Moderator
Posts: 14299
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to open new frame from button

Post by doublemax » Sun Jul 28, 2019 6:13 pm

Building the samples with CodeBlocks (or any IDE) is not that simple. If you just want to run and check a sample, build it from the command line.
Use the source, Luke!

marcusbarnet
Experienced Solver
Experienced Solver
Posts: 55
Joined: Sat Jul 27, 2019 3:45 pm

Re: How to open new frame from button

Post by marcusbarnet » Sun Jul 28, 2019 7:15 pm

I'm able to correctly compile the sample by using line commands, but I still get the errors when I try to compile it by using Codeblocks.

Code: Select all

amples/wizard/wizard.cpp:20:
./../../include/wx/msw/chkconf.h:27:10: error: #error "wxUSE_WINRT must be defined."
 #        error "wxUSE_WINRT must be defined."
          ^~~~~
./../../include/wx/msw/chkconf.h:43:9: error: #error "wxUSE_DBGHELP must be defined"
 #       error "wxUSE_DBGHELP must be defined"
         ^~~~~
./../../include/wx/msw/chkconf.h:107:9: error: #error "wxUSE_TASKBARBUTTON must be defined."
 #       error "wxUSE_TASKBARBUTTON must be defined."
         ^~~~~
./../../include/wx/msw/chkconf.h:378:13: error: #error "wxUSE_DRAG_AND_DROP requires wxUSE_OLE"
 #           error "wxUSE_DRAG_AND_DROP requires wxUSE_OLE"
             ^~~~~
./../../include/wx/msw/chkconf.h:389:13: error: #error "wxMediaCtl requires wxActiveXContainer"
 #           error "wxMediaCtl requires wxActiveXContainer"
             ^~~~~
In file included from /usr/include/wx-3.0/wx/string.h:45,
                 from /usr/include/wx-3.0/wx/memory.h:15,
                 from /usr/include/wx-3.0/wx/object.h:19,
                 from /usr/include/wx-3.0/wx/event.h:16,
                 from /usr/include/wx-3.0/wx/window.h:18,
                 from /usr/include/wx-3.0/wx/nonownedwnd.h:14,
                 from /usr/include/wx-3.0/wx/toplevel.h:20,
                 from /usr/include/wx-3.0/wx/frame.h:18,
                 from /home/robodyne/Downloads/wxWidgets-3.1.2/samples/wizard/wizard.cpp:28:
/usr/include/wx-3.0/wx/wxcrtbase.h:41:14: fatal error: io.h: No such file or directory
     #include <io.h>
              ^~~~~~
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
6 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 
In the build options, I have: "`wx-config --cflags`" and "`wx-config --libs std,aui`" for the linker.

User avatar
doublemax
Moderator
Moderator
Posts: 14299
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to open new frame from button

Post by doublemax » Sun Jul 28, 2019 8:21 pm

I don't use Linux, but most likely the include path for wx/setup.h is missing. For a wxWidgets project two include paths are needed. One is configuration specific, that must be the first one, because wx/setup.h is included from there.

e.g. if you build wxWidgets in <wxdir>/build-debug/, there will be a custom copy of setup.h in
<wxdir>/build-debug/lib/wx/include/<platform>/wx/

The second one is the generic <wxdir>/include/

Maybe this can help, even if it's written for Windows:
viewtopic.php?f=19&t=46125
Use the source, Luke!

Post Reply