Skip to main content

Posts

Showing posts from May, 2009

download ibpp and its documentation

Okay, I think it's time to try make a real database application using C++ and WxWidget. The tools needed which I already have so far: C++: it is a native language with linux. Almost every linux distribution have it, and if you don't have it and you're using ubuntu, just install package base-essential with synaptic or apt-get. WxWidgets: the main library which supposed to make our life easier. Code::Blocks: the IDE Firebird database server. We still need client library for accessing the database server. WxWidgets has database access functions using ODBC. But, I don't like ODBC, I prefer to have client library which access the database natively. After some google research, ibpp seems the best c++ firebird client library. I downloaded the library from http://www.ibpp.org/. But, a library is no use at all without documentation and it's very unfortunate ibpp only provides online documentation. As we live in Indonesia we certainly need an offline documentation so we can w

Program timbangan elektronik, sebuah program Windows yang dijalankan di Linux.

Kemarin, mumpung hari libur aku setup program timbangan digital baru di kantor. Program yang lama merupakan program DOS yang aku tulis dengan menggunakan Clipper, program ini berjalan dengan baik di linux dengan bantuan dosemu. Program baru merupakan program Windows. Salah satu improvement dalam program ini adalah support untuk beberapa jenis indikator. Program diinstall di linux dengan wine versi 1.1.20. Beberapa catatan dalam instalasi program ini di wine: Pencetakan slip bukti timbangan dan laporan-2 menggunakan printer Dot Matrix. Apabila pencetakan dilakukan lewat printer driver, pencetakan dengan printer dot matrix akan menjadi sangat lambat plus hasil buruk plus boros pita... :) Oleh karena itu, program ini melakukan pencetakan langsung melalui printer port lpt1. Di windows, hal ini tidak menjadi suatu permasalahan, di linux dengan wine, maka lpt1 akan dimap ke /dev/lp0. Masalahnya, owner dari device ini adalah root dan group lp. Secara default user-user di Ubuntu (..nggak tahu

Installing code::block

Now, I begin to understand the mechanism of wxWidget. Time to look for a good IDE. After some googling session, I decide to install code::block. At first, I downloaded the source code. However, I failed to build it myself and found it is too complicated to rectify the problem. So, I downloaded the *.deb package and installed it: $wget -c http://transact.dl.sourceforge.net/sourceforge/codeblocks/codeblocks_8.02-0ubuntu1.deb.tar.gz $tar -xf codeblocks_8.02-0ubuntu1.deb.tar.gz #sudo dpkg -i *.deb Surprisingly, right after the package installed synaptic update manager shouted that an upgraded package is available from repository .... :) If only I knew from the beginning I will install from the repository instead...:)

wxWidgets: Adding menu and status bar

Steps to add menu: Define IDs for our menu items enum { ID_QUIT, ID_ABOUT, ID_POPUP }; Create instances of wxMenu inside the constructor of the main windows wxMenu *MenuFile = new wxMenu; MenuFile->Append( ID_ABOUT , _T("&About")); MenuFile->Append( ID_QUIT , _T("&Quit")); wxMenu *MenuData = new wxMenu; MenuData->Append( ID_POPUP , _T( "Another &Form")); Create an instance of wxMenuBar wxMenuBar *MenuBar = new wxMenuBar; Add our instances of wxMenus to the menubar MenuBar->Append( MenuFile , _T("&File") ); MenuBar->Append( MenuData , _T("&Data") ); Assign the menubar to the main windows this->SetMenuBar( MenuBar); Declare event function in our main windows class declaration class MainWindow: public wxFrame { public: MainWindow(const wxString& title , const wxPoint& pos , const wxSize& size ); void MenuClickQuit( wxCommandEvent&

wxWidgets:Hello empty world!

Basic skeleton learnt: Have to declare an application class derived from wxApp Have to override virtual function OnInit of this class Have to declare a main window class derived from wxFrame (windows is called frame in wxWidgets) in OnInit of our application class, we should create (define) an instance of the main window class defined in step 3. Set this frame (window) as the top window with method SetTopWindow Don't forget to set its visibility to True with show method To make the main() entry point, use macro: IMPLEMENT_APP( OurAppClass) which translated to complicated statement but then last with: int main( int argc , char ** argv ) { return ( wxEntry( argc , argv) ) }; Bulletes which bit me: The method name should be OnInit() but I wrote onInit() and nothing comes up to the screen. It took 1 hour to figure out what's going wrong. At least I now know wxWidget naming convention is EveryFirstWordShouldBeCapitalized() Compiling: g++ hello.cpp `wx-config --libs` `wx-config --cx

Installing on Ubuntu 8.10

WxWidgets is available from ubuntu standard repository, but it often lacks several version. Fortunately, the developer of wxwidget provides ubuntu repository: Add this lines to /etc/var/sources.list: deb http://apt.wxwidgets.org/ intrepid-wx main deb-src http://apt.wxwidgets.org/ intrepid-wx main (note replace intrepid with your ubuntu distribution) and then import security key: #curl http://apt.wxwidgets.org/key.asc #curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - if you don't have curl, you can install it first: #apt-get install curl After that, update the repository: #sudo apt-get update And then install wxwidgets from synaptic. Here are the packages I installed: wx2.8-il18n wx2.8-doc wx2.8-headers wx2.8-examples libwxgtk2.8-0 wx-common libwxgtk2.8-dev wxformbuilder libwxbase2.8-0 libwxbase2.8-dev After installing the packages, the documentation is the most important. The html reference is located in: /usr/share/doc/wx2.8-doc/wx-manual.html/index.html I opened the fil

Preface

Welcome to my personal blog! Hi, this is my personal blogs for various topics: programming, daily things, thoughts, etc. Comments are appreciated here and be prepared to see mixed languages here.