Code::Blocks Forums
User forums => General (but related to Code::Blocks) => Topic started by: nishalns on July 24, 2013, 12:35:46 pm
-
I am referring to the program given in the link: http://docs.wxwidgets.org/trunk/classwx_thread.html (http://docs.wxwidgets.org/trunk/classwx_thread.html). Now, in my program I want to write "MyFrame" and "MyThread" classes in seperate '.h' and '.cpp' files. How would I do that?
Also, is there a way by which I can add threads to my project in wxsmith just as I add wxFrame, wxDialog,etc. from the wxSmith menu.
-
- Create the frame using wxSmith, naming it as you like (i.e. MyFrame). This results in MyFrame.cpp and MyFrame.h being created.
- Implement the Thread class into own files
- Reference this class in your "MyFrame" class, or wherever needed. Notice that wxSmith has (by design) no interface to a wxThread, as it is not a GUI (related) class.
-
- Create the frame using wxSmith, naming it as you like (i.e. MyFrame). This results in MyFrame.cpp and MyFrame.h being created.
- Implement the Thread class into own files
- Reference this class in your "MyFrame" class, or wherever needed. Notice that wxSmith has (by design) no interface to a wxThread, as it is not a GUI (related) class.
Can you give me a short example demonstrating this. I'm finding it a bit difficult to understand...
-
Can you give me a short example demonstrating this. I'm finding it a bit difficult to understand...
Suppose you have a MyThread.h and MyThread.cpp which have class MyThread's declaration and implementation, then in the MyFrame.h or MyFrame.cpp, just use
Put MyFrame.cpp into your project, that's all.
-
Well, thanks all for answering my question. Actually, I included the 'MyThread.h' in 'MyFrame.h' and vice versa and also used forward declaration and the problem was solved.