Implementation of Multiline Text Wrapping for Single Line OS/2 PM Controls
Original Publication Date: 1995-Feb-01
Included in the Prior Art Database: 2005-Mar-30
Morgan, SA: AUTHOR [+2]
OS/2* Presentation Manager* (PM) applications often use radiobutton and checkbox controls in dialog windows. As provided by PM, these controls present the radiobutton or checkbox bitmap, followed by a single line of text. This text is limited to 127 characters and is always painted on a single line.
Implementation of Multiline Text Wrapping for Single Line
Presentation Manager* (PM) applications often use
radiobutton and checkbox controls in dialog windows. As provided by
PM, these controls present the radiobutton or checkbox bitmap,
followed by a single line of text. This text is limited to 127
characters and is always painted on a single line.
restrictive for applications that want to provide a
more detailed description in the text of these controls. It can also
present problems during language translation, as the translated text
could be much longer than the original text.
solution for presenting these controls is to allow
unlimited text length, with support for wrapping the text into
multiple lines. The implementation of text wrapping for these
controls requires that five areas be addressed, each one keying off a
standard PM message:
o Internal data structures need to be created and maintained
the life of the control.
The WM_CREATE message is received when the control is being
created. At this time the necessary structure for storing such
things as the control text in multiline format must be
A pointer to this structure can be stored in the control window
o The text must be broken into its separate line components when
initially set and if changed at runtime.
The WM_SETWINDOWPARAMS message is received when the text
for the control is initially set and whenever it is changed by
the application. Upon receipt of this message, the application
must determine how the text should be split. There are several
good techniques, but this disclosure assumes that the breaks in
the text string are delimited by a special character reserved
These substrings should be stored in the internal memory
previously allocated. By storing the substrings, the
hit of having to parse the original text into substrings each
time the control needs to be painted is eliminated. The length
of the longest substring and the count of substrings should
be stored, as they are useful in performing some of the
calculations for repainting and displaying of the cursor box.
o The wrapped text must be painted by the application.
The WM_PAINT message is received when the text needs to be
repainted. Any required background repainting is done first
is achieved by calling the WinFillRect API on the control text
rectangle area with the background color. The control
is obtained with the WinQueryWindowRect API.
The painting of each line of the text (that is, each
substring) must then be perform...