spacer spacer spacer spacer spacer spacer spacer spacer
Luigi Bianchi Web Site spacer
spacer Home Software Programming Others About spacer spacer
spacer spacer
spacer spacer

OWL/OWLNext (Programming)

separator images

Dieter Windau implemented some years ago an Office97 style bitmap menu (TBmpMenu). I have done some changes to its code to make it work with OWL6 (I have replaced the BIDS stuff with STL code) and I have also added an XP look and feel. I must confess that it was not easy to have the same XP look, but the code written by Dieter was very clear and so I spent just few hours to approximate XP behaviour. I hope that someone could improve it. Please, note that Dieter is the author of the majority of the code and of the complete idea. You can find his original code here. If you'd like to thank someone for this code, please start with him!
I'd like to have some feedback because there are several variables to take into account (XP themes, different OS, etc..). I have checked it with OWLNext 6.1 and BCB5 (VCL compatible libraries) as well as with BC502 and OWL52.
UPDATE (9 March 2002):
I have fixed some small bugs, made it more compatible with VC (thanks to Mark Hatsell), completely rewritten the DrawItem function to make it more readable (I added too many if around), I have also added a left vertical bar (optional, see picture), a couple of vertical lines (optional, see picture) and I have improved the background bitmap drawing (which I had broken from the original code). Again, as there are many variables (I have received email from programmers that were using 4 different compilers and several OS), please let me know if it works or not in your configuration.
1 March 2002

last update
9 March 2002
Another porting from MFC to OWL. Well, I originally ported it to plain SDK API programming, and then to OWL. The original author is Ernest Laurentin that uploaded CPeakMeter to CodeProject (Multimedia PeakMeter Control). I added a couple of new functionalitites and made some important changes, but the original idea and implementation belongs to Ernest. I hope that someone will use it and maybe will send me some feedback. Also improvemens are wellcome. BTW, as it is important that the size of the LEDs is always the same, don't use strange values for the control size and number of leds.
24 February 2002

I have never found a simple OWL UpDown Button Gadget, that is a button that you can put on a toolbar and that displays different glyphs depending on its Up/Down state. It is however simple to build such a class: it is sufficient to derive it from TButtonGadget and ovverride two virtual functions. Here you can download the required code.
Just few notes about the constructor:

TResId bmpResIdUp,
TResId bmpResIdDown,
int id,
TState state = Up,
TModule* res_mod = ::Module)

Here bmpResIdUp and bmpResIdDown are the TResIds of the Up and Down glyphs, respectively, id is the Command Id associated to the button, state is the initial button State (defaults to Up) and res_mod is the TModule* in which the glyphs are stored. For the other things, you can use it as a TButtonGadget and put it on your toolbars. It's so easy that I don't provide any example...

28 January 2001

I must confess that I have tried several times to have a Dockable DialogBox with OWL, but I always failed. Now I have discovered that it is really simple, provided that you do the right things! Did you believe that you just need few lines of code? Read on, if you don't believe me!

The first thing to do is to create your TDialog (Dock, in the following lines) with the DS_CONTROL flag in your resource file. This prevents some strange (but interesting) behaviour. Then you have to put the TDialog into the TDockableControlBar. To do so, you just need to add these lines of code:

TDockableControlBar* cb2 = new TDockableControlBar(frame);
Dock* d1 = new Dock(frame);
cb2->Insert(*new TControlGadget(*d1));
ApxHarbor->Insert(*cb2, alTop);

That's all. Don't you believe me? You can download an example (here) in which 4 DialogBoxes (a copy of the same one) are constructed and that you can move, resize and attach to any border. The example is really a quick and dirty one, just to show you that it works! It was generated and checked with BC502 AppExpert and OWL502, but it should work with OWLNext too (I'll try this really soon).
Below are some (really small, sorry) screenshots which show you the 4 dialogs attached to the top and left border and then floating. Please, note that the controls within each DialogBox do not move, as it happens when you put the controls directly in the controlbar. But if you split your Dialog in more "subdialogs"....

DialogBox Docked to top border DialogBox Docked To Left Border DialogBox Floating

3 November 2000

This is another porting to OWL of a MFC sample that I have found at CodeProject. It is a control similar to that used by Microsoft Word to create a table and more precisely to choose the number of its rows and columns. In general, you can use this control to choose how many objects are needed in an 2-D array. I'll use it in a biomedical commercial product in order to select the number of views of an EEG 3-D potential maps. The original MFC code was written by Rajiv Ramachandran. It is interesting to note that until now all the MFC to OWL portings have produced a smaller amount of source code, while the binaries are bigger.
I checked it with BCB4 and with BC502 and with OWL52, OWL54 and OWL6.1.
Source code and a simple example can be downloaded from here. Click and drag on the client Windows to see it in action!

24 october 2000

Property Dialog

Property Dialog

This is a porting of a MFC property dialog that was published on the August 2000 (?) issue of Windows Developers Journal (Author:Christopher Dix). A lot of changes have been made since that release, mainly to try to give it a more object oriented design. I partially failed in achieving this goal (it is much more difficult to change design idea than porting a MFC application into OWL!), and I originally didn't want to put it on this Web Page. But it seems to work, and it comes with an example, so it is possible that someone could find it useful. I hope that someone wants to improve it and fix all the bugs and/or features that I have left, and maybe that he wants to communicate it to me.
N.B.: To see it in action, select the Help|About menu item
Thanks to Jogy (again!), it has been tested and modified to make it work with BC502/OWL52. I also checked it under BCB4 with both OWL54 and OWL6.1.
Source code and a simple example can be downloaded from here.

2 October 2000
Last fix: 9 October 2000

OWL Color Picker Dialog

OWL Color Picker Dialog

This is a porting to OWL of a MFC color picker dialog. I have found the source code at The author of the priginal MFC code is Rajiv Ramachandran. You can download the source code (145KB including and example), the compiled example (318KB), or both (463KB). I really hope that someone will port to OWL some of the other MFC classes/extensions. I have tested it with BCB4/BCB5, OWLNext 6.09 under both WIn98 and Win2K. It should also work with OWL5, even if I haven't tried it. I'd like to convert to OWL one MFC extension for every month. Anybody wants to help me?

10 August 2000

OWLNext Spin Control

Text and Float Spin Control

Many years ago Steve Saxon made a spin control with some useful features (floating point support, string lists, etc.). Iíve used it several times in my projects. Now Iíve just made few changes to make it compatible with OWLNext (Steveís original project was released in the OWL 2.0 days). If somebody is interested in this control, he can download it from here. You can find the code and a simple example. I'd like to thank Jogy for having fixed the OWL5 compatibility (because I didn't checked it). Actually I have tested this with BCB4/OWL6.092 and with BC502 with OWL5. Note that an undocumented feature is the right button click...
Jogy, the great Jogy, has also reported and fixed a bug in the TSpinEdit destructor that is now included in the zip file.

15 July 2000
Last fix: 3 October 2000



This simple utility retrieves some network info and stores it in a list of strings for further processing.

The function prototype is

bool EnumNet(StrList& list, DWORD dwLevel, LPNETRESOURCE lpNet);

where StrList is a typedef for list<string>.
The usage is simple: imagine that you want to use if with a OWL::TListBox† object. If lb is a pointer to the object, all you have to do is:
StrList sl;
if (EnumNet(sl, 0, NULL))

† for (sl_It i = sl.begin(); i != sl.end(); i++)
††† lb->AddString((*i).c_str());

In the case of plain SDK API programming, the code will become, assuming that hWndLB is the HWND handle of the listbox:

StrList sl;
if (EnumNet(sl, 0, NULL))

for (sl_It i = sl.begin(); i != sl.end(); i++)
† †† SendMessage(hWndLB, LB_ADDSTRING, 0, (LPARAM)(LPCTSTR)(*i).c_str());

In both cases, youíll obtain a thing like this:

ComboBox with net resources

1.0 Ė 09 June 2000

© Copyright (2000), Luigi Bianchi
Last Update:
March 9, 2002