Dec 122017
 
Borland C++ OWL example of a ribbon bar.
File OWLRIBBN.ZIP from The Programmer’s Corner in
Category C++ Source Code
Borland C++ OWL example of a ribbon bar.
File Name File Size Zip Size Zip Type
RIBBON.CPP 3483 1301 deflated
RIBBON.EXE 19968 4608 deflated
RIBBON.RC 914 491 deflated
RIBBON.TXT 1837 971 deflated

Download File OWLRIBBN.ZIP Here

Contents of the RIBBON.TXT file


NOTES FOR RIBBON.CPP

RIBBON.CPP is the simplest method I've found for creating a customizable
ribbon bar (sorry, Borland -- I mean "Speed Bar ()") (oops - sorry,
Microsoft, I mean "Toolbar ()") in a standard window.

Essentially, what Ribbon does is use a modeless dialog box that
can be created with any resource editor (I used Resource Workshop,
but you can use WRT, MS Dialog Editor, etc.) as a template
for the ribbon bar. In the dialog template, the dialog box is
created to be wider than the maximized window on a standard display.
This ensures that it will always cover the entire width of the window
it is displayed in. It is created as a child window to simplify
positioning (it defaults to 0,0 of the parent window) and is given
its own window class to allow for simple painting when the WM_PAINT
message is received (for top and bottom highlighting, giving it a
nice 3D appearance).

Since the ribbon bar is at its heart a dialog box, standard
ObjectWindows calls are made to control it. TRibbonDialog is a
TDialog descendant, with very few methods overridden. In the
main window, it is initialized via a GetApplication()->MakeWindow() call,
thus creating a modeless dialog box. Any notification messages are
processed by the programmer.

Lots of users here have expressed a desire to incorporate a ribbon bar
in new applications. It seems to be becoming a semi-standard part of
the evolving Windows GUI, and I think its a good addition. Hopefully,
a glance at this code will show you how simple creating a ribbon bar
can be. Of course, you might want to spruce it up with owner
drawn buttons or other exotic controls. Having the ability to
create the basic design in a resource editor simplifies the
job considerably.


Michael D. Most
Valencia, CA.
2/14/92


 December 12, 2017  Add comments

Leave a Reply