Feedback Search Top Backward Forward
EDM/2

The Codesmith's Library

OS/2 Warp Programing for Dummies

Written by Jorge Martins

 

Introduction

In The Codesmith's Library, we focus on development books and materials. Pick up whichever book strikes your fancy, and join the growing group of people following our programming columns.

Please send your comments and thoughts so that we can make this column what you want it to be.

OS/2 Warp Programing for Dummies

This book belongs to the "...For Dummies" series, but don't jump to conclusions. Even if you don't consider yourself a "dummy" this book might be for you. Actually, as I progressed though the book I got the impression that, after an original text, the puns and cartoons were inserted to fit the series.


Introduction
     Part I: From Square One (and Ground Zero!)
1.   The Elements of OS/2
2.   Understanding Warp Programs
3.   The Basic Application Framework Explained
4.   Get Your Feet Wet and GUI
5.   Of Mice and Messages
6.   Input! More Input!
     Part II: Resources and Dialogs - Getting in touch with your OS
7.   What's on the Menu
8.   Bitmaps, Icons, and Pointers
9.   An Introduction to Dialogs
10.  Dialoguing with Warp
     Part III: OS/2 Controls
11.  A Look at Controls
12.  Buttons
13.  Entry Fields
14.  List Boxes and Combo Boxes
15.  Spin Buttons
16.  Sliders
17.  Value Sets
     Part IV: Polish and Panache
18.  A GPI in a Pool of Sharks
19.  Fancy Fonts
20.  Dynamic Link libraries
21.  Threads and Semaphores
22.  Stupid WPS Tricks
     Part V: WorkPlace Shell Basics
23.  SOM: Kind of Wonderful?
24.  The WorkPlace Shell: Object of Envy
25.  Notebooks and States
26.  Containing your excitement
     Part VI: The Part of Tens
27.  Ten Alternatives to C and C++
28.  The Future
Glossary
Index

The introduction describes what this book is all about, its organization and conventions, for whom it is intended and its goals.

In the first chapter, the author identifies the basic components of OS/2 which make it tick. Following that, there are brief explanations of what Presentation Manager is and of the WorkPlace Shell. Although, the author prefers Pascal, he acknowledges the dominance of C, so this book has C code.

Chapter two covers basic concepts surrounding the Presentation Manager application model. Blake Watson (the author) explains what event-driven application programming is all about, and how it is accomplished under OS/2 using Presentation Manager. Then, window classes, parenthood and ownership are all explained. In this chapter, there is an interesting section about flags and their use. The author supplies instructions on how to compile OS/2 programs using IBM C/Set++ (now VisualAge C++), Watcom C/C++ 10.0 and Borland C++ for OS/2.

Chapter three goes further, explaining what the many parts of a basic application framework for Presentation Manager do, in a line by line dissection. Subjects such as the creation of a message queue, message dispatching and window procedures are covered. This chapter should provide the reader with a starting skeleton for PM application development. I particularly liked the explanation about Window Styles where the author gives a thorough explanation of how bitmasks work. I consider this to be a valuable help to the beginning programmer as opposed to the beginning OS/2 programmer.

Chapter four introduces presentation spaces and some GPI (Graphics Programming Interface) concepts. This is with the intent to display "Hello World" in a window. The WM_WAIT message handling is also discussed.

Chapter five introduces Window Words and their use. There's also a deeper explanation about PM messages. This is a constant in this book, as the author progressively presents information on a need-to-know basis. The main subject of this chapter is how to handle mouse events such as button clicks.

Chapter six covers keyboard input and scroll bar event handling. There's also a light introduction to timers.

Chapter seven deals with menu creation and consequently introduces resource files. The author steps through menu bar creation and then proceeds to pop-up menus, which enable the programmer to provide context menus and simulate the WPS look-and-feel. Then, to beef things up, bitmap menu items and hot-keys are discussed.

Following this is a small chapter (the eighth) describing how to create icons and then associate them with your application. There's a description of the various system pointers and information on how to use homegrown pointers. To end the chapter, the reader is presented with a simple way to display bitmaps.

Blake Watson proceeds to user interaction through dialog boxes in chapter nine. Message boxes and their many uses, such as quit confirmation and error display, are presented. In this chapter, the basic application framework used throughout the book is changed to accommodate the new material. Finalizing the chapter is a very simple example of how to use the common File Dialog.

The obvious next step is to create custom dialogs in your application. This is covered in chapter ten. There's a full example of how a dialog procedure looks like, as well as an introduction to dialog modality.

Chapter eleven through seventeen cover many kinds of controls available on PM such as Buttons, Entry fields, List/Combo boxes, Spin buttons, Sliders and Value Sets. The usual material to be found in PM programming books.

In chapter eighteen, the author explores the GPI (Graphics Programming Interface) and goes further on Presentation Spaces. Lines and their styles as well as bitmap blitting are discussed. Closing the chapter, there's a complete program demonstrating the topics covered.

Chapter nineteen features a general introduction to fonts (including bitmap vs. scaled fonts and font metrics) and then proceeds to actually drawing text in the screen. The reader is then encouraged to experiment with the various text effects such as rotation.

Chapter twenty explains DLLs, their advantages and disadvantages, why they exist and how to build them. The concept of Dynamic linking precedes concise instructions on how to properly create a simple DLL and then use it. Here, the reader is introduced to module definition files for the first time. The chapter ends with an example of how to dynamically load resource DLLs.

The concepts of session, process and thread are explained in chapter twenty one, as well as event semaphores. I found this chapter to be somewhat terse. Such an important subject surely deserved more space in the book.

Chapter twenty two breaks from plain PM to the WPS and from C to REXX. Here are presented, what the author calls "Stupid WPS Tricks", a tutorial on how to write a REXX script to install your application. This is a refreshing (and necessary) chapter.

I found chapter twenty three through twenty six to be most interesting and unexpected. Those chapters deal with the awesome IBM System Object Model (SOM) and provide the reader with an actual (but very simple) WPS program. The author takes the trouble to keep simple what can become really hairy. Chapter twenty five introduces Notebooks out of the need to create the settings (now properties, with Warp 4) notebook of the class being developed. Chapter twenty six deals with drag-and-drop support, again for the WPS class being developed.

Chapter twenty seven is unique in the sense that it lists ten alternatives to the C and C++ language (including compilers and interpreters) as well as the addresses of mentioned vendors. The author openly states that he isn't the biggest fan of C and C++ there is. Nevertheless, it is "Good Thing" to keep an open mind <g>.

The last chapter (twenty eight), talks about the future of the beginning programmer and the future of OS/2. Some of these predictions have materialized, some have failed (OpenDoc comes to mind).

The book ends with a small glossary and a standard index.

Summary

OS/2 Programming for Dummies is a very good introductory book on OS/2 PM programming with a slight incursion into WPS programming. It is well written and generally refreshing. This book provides an inexpensive way to get your feet wet and then move to more advanced texts. There are some cases of oversimplification that could induce in error, such as identifying the "Single Input Queue" as problematic, but not stressing out that the problem lies with its synchronous nature. Some chapters are somewhat terse but the book is funny and does its job well.

I give it an A-.

OS/2 Warp Programming for Dummies, Blake Watson

  • IDG Books Worldwide, ISBN 1-56884-337-2, $US19.99, $26.99CAN, UK18.99.
  • Intended audience: Beginning OS/2 Warp Programmers
  • Mark: A-

Reviewed Books

Our Bookstore has reviews and links to Amazon for all books we have reviewed in the past, as well as several books waiting to be reviewed, and others which we recommend.