Demonstrates how to make OS/2 Presentation Manager frame controls (toolbar and status bar) dockable and floatable at runtime. The user can detach the toolbar or status bar into its own floating frame window, hide it, or re-dock it back into the main frame — all without restarting the application.
The technique subclasses the frame window procedure to intercept
WM_QUERYFRAMECTLCOUNT and WM_FORMATFRAME, allowing the application to
dynamically add or remove controls from the frame layout. A floating control is
hosted in a second, minimal frame window that is itself subclassed to format
its single child.
The sample also includes a basic MLE-based text editor (New, Undo, Cut, Copy, Paste, Clear) with a bitmap toolbar and a status bar that tracks cursor line and column.
- Dockable / floatable toolbar (bitmap menu)
- Dockable / floatable status bar
- View menu to toggle visibility of each control
- MLE editor with standard edit commands
- Line / column display updated via WM_TIMER
src/
editor1.cpp Main source (window procs, docking logic)
editor1.h Resource ID definitions
editor1.rc Menu, toolbar, dialog, bitmap, and icon resources
comments.ico Application icon
*.BMP Toolbar button bitmaps (Undo, Cut, Copy, Paste, Clear)
editor1-gcc.def Module definition file for GCC/kLIBC linker
editor1-ow.lnk Linker response file for OpenWatcom wlink
| Tool | Version |
|---|---|
| OpenWatcom | 2.0 (wpp386, wlink, wrc) |
| GCC / kLIBC | 9.2 bitwiseworks (g++, wrc for resources) |
| OS/2 Toolkit | for os2.h and PM headers |
OpenWatcom 2.0
compile-ow.cmd
Output: bin-ow\EDITOR1.EXE
GCC 9.2 / kLIBC
compile-gcc.cmd
Output: bin-gcc\EDITOR1.EXE
The compile scripts set the required EMXOMFLD_* environment variables and
write a build log (compile-ow.log / compile-gcc.log).
Not specified by the original authors.
- Eric Slatts (original EDM/2 sample)
- Alger Pike (docking control support)
- Marc Mittelmeijer
- EDM/2 article: http://www.edm2.com/index.php/Dynamic_Control_Formatting
