Thursday 8 December 2016

wxWIdget and How to use it -CodeLite-

Today I will post about wxWidget and how to use it as a library.

So what is wxWidgets?
wxWidgets is a C++ library that lets developers create applications for Windows, Mac OS X, Linux and other platforms with a single codebase. It has popular language bindings for Python, Perl, Ruby and many other languages, and unlike other cross-platform toolkits, wxWidgets gives applications a truly native look and feel because it uses the platform's native API rather than emulating the GUI. It's also extensive, free, open-source and mature. (refer to wxWidget's sites).

How do we configure it?
We are going to use CodeLite as our IDE. Please follow this link about how to install CodeLite and MinGW as well. This section below will be explaining how to add wxWidget to CodeLite.

1. Download wxWidgets -open this link-.

2. Extract it to C;\

Now open CodeLite !

1. If you new to CodeLite, please create a new Workspace in C++.

2. Right Click to your new Workspace and create a new project.
3. Select GUI : wxWidgets GUI Application (wxFrame, using WxCrafter) as your project template
4. Write your project name and set the compiler to MinGW ( TDM-GCC-32 )
5. At the Workspace View, you can see you've made the project
6. Try to right-click to your project and click Build
7. At the Output View, it shows some error. It means that we haven't set the Environment Variables, especially the wxWidget 
8. Click Settings -> Environment Variables

9. Please write down like this to the box
10. Then try to Build the project again. and it won't be an error again

Let's start !
I'm going to show you how to create a new project, create a textbox, button and when the button click, it shows “Hello, [textbox value]" using a dialog or to another label (not terminal/console) with CodeLite.

As you can see, wxFrame, the project which you make before having 3 folders which content used to make the program

1. Click the wxcrafter.wxcp to see the workspace of the program
actually, you can just do the view by dragging it to the MyFrame

2.  First, add some text to it
-  Click m_MainToolbar and add wxStatic Text-
-To change the default text, find the upper-right box
-> Control Specific Settings -> Label-

3. Second, add wxTextCtrl 

3. Third, click BoxSizer1 at the upper right box ( Workspace view ), and click the wxButton





No comments:

Post a Comment