addons in codeblocks, trying to get ofxhGui working

wanted a gui with editable text box. found ofxhgui ( and downloaded. happy to try others if easier for linux…

i added src directories to the addons folder, OF 07, ubuntu 10.10

started a new project copied from all addons,
but also now needed to add the ofxgui stuff-> followed this manual procedure
dragged files individually from blue folders to green folders. see attached image.

no luck though, when i try to compile, it can’t find the .h files which are clearly showing in the sidebar.

there is something else i need to edit in the codeblocks project options somewhere?


In 007 you just need to add the name of the addon to the addons.make file in build_config. Having the files in the project will make it easier to work with it and enable autocomplete but it’s actually not necessary to compile.

also if you add the addon to addons.make and run:

python scripts/linux/ path_to_your_app  

it will add the files for the addon to the codeblocks project.

You will need to run

sudo apt-get install python-lxml  

for the script to work

thanks arturo. that finds the .h file.

i also had to clean the ofxhGui directories of a lot of ._blah.cpp type files which i assume is some remnants from osx.

there was also one place (ofxhUtils/src/hTable/hTable.cpp) where FLT_MIN and FLT_MAX where used. the compiler couldn’t find them. i’m assuming that in certain environments they are automatically defined but for codeblocks i guess not?
i manually defined them but was wondering if there is a missing #include that would link them to the official c++ values.

anyways, hgui is up and running! now i just need to get the arrow keys to work within the editable text box…

yes you usally need to include float.h in some older versions of gcc (usually osx is 1 or 2 versions behind linux in the gcc version) include some headers indirectly through other headers, that’s why it’s working in osx.

go to hTable.cpp

and replace
#if defined( __WIN32__ ) || defined( _WIN32 )
#include <float.h>

#if !defined( __APPLE_CC__ )
#include <float.h>

so I think it should work on the 3 platforms (mac, windows and linux)

thesixmil, the arrow keys don’t work actually on the editable text box.
This is on my 'To Do" list. (the reason whyI postponed that is that it is difficult to make it work correctly with scrolling)

Other things that are actually missing are selection and copy/paste.
(I have to implement copy/paste routines that are multiplatform)

Note also that actually, changing the text insertion point and scrolling works on hTextArea (multi-line text) but not on hTextBox (single line text).

I tried ofxhGui on Ubuntu 11.10
and I found that on Unity, the fonts in the text areas look very bad
when in Gnome3 they seems ok.

There are also some little esthetic bugs on ubuntu to correct:

in the file hSlider.Cpp
in void hSlider::draw(void)

the line
hLine (x+position+1, y+1, x+position+1, y+h-1);

should be replaced by
hLine (x+position+1, y+1, x+position+1, y+h);

and in the file hStatusBar.cpp

in void hStatusBar::draw(void)

the line
hDrawString(gui->ffont, data->label, x+2, y+gui->ftextHeight-2);

should be replaced by
hDrawString(gui->ffont, data->label, x+2, y+gui->ftextHeight-1);
(but not in windows and mac os x)

(I should really find another way to draw lines and rectangles (maybe to write directly to a pixelmap on an FBO ?)

ofxhGui update for linux users is now available