WxWidgets Part 1: Hello World!

October 23rd, 2009

In this tutorial, I’m going to walk you through steps required to build a very simple graphical application using WxWidgets. I assumed you have it installed and ready to work with.

#include <wx/wx.h> //this is the main header for wx stuff you use

//we inherit the class wxApp for our own class for the application
class mainApp : public wxApp {
public:

bool OnInit(); //we need to define it’s OnInit function in order to use the class

};

bool mainApp::OnInit() {

//now we create a frame so that our app can use it to show things

// parameters: parent window, window id, title text, position, size

wxFrame *myFrame = new wxFrame(NULL, wxID_ANY, wxT("DarKLorD's Domain is right HERE!!!"), wxPoint(20, 20), wxSize(200, 100));

myFrame->Show(true); // show our window now! :D

return true;

}
IMPLEMENT_APP(mainApp) //this one may seem weird for you, but it’s wxWidgets way, now! finished! :D

Squeezing Down the Outcome

October 23rd, 2009

In order to remove debug information from your executable when compiling, do the following with GCC compiler:

> gcc -s -Os source-code.cpp

the -Os option tells the compiler to use the highest optimization settings. There are more options you can use to make it even smaller, visit here for more details.

Removing System Beep in Linux

October 21st, 2009

If you are like me and state that system beep is really annoying, there’s no need to cut that thing off the computer! just do this as root:

> rmmod pcspkr

Yes! that was all need to be done! But you have to do that every time you start the system up, so just add it to init.d scripts to have it run automatically. If you find better ways, write them into comments.

My Current Project – In Development

October 19th, 2009

It’s named “Divine” and is a file splitter/merger for Linux systems… right now it may seem totally useless for you but I have further thoughts for it :)