Q: How do I do auto exit?

A: Auto exit is a characteristic of the COBOL ACCEPT statement that is widely used in character applications. Auto exit, however, is not a typical Windows application behaviour, and is not provided as a characteristic of the Windows edit box.

You can manually implement auto exit by responding to the KeyPress event and using the SetFocus API function to move input focus to the next control.

Q: How do I get overtype behavior?

A: Overtyping is not allowed by the Windows edit box without first selecting the characters to be overtyped. The characters can be selected with the mouse, or by using the keyboard shift and arrow keys (hold down shift while pressing the arrow key).

Q: How can I display a form at a specific location determined at runtime?

A: The easiest way to do this is by initially displaying the form with the Visible property set to FALSE. This will allow you to change the Top and Left properties to the new location for the form. Once you have set the new location, set the Visible property to TRUE.

Q: How do I create a toolbar?

A: The toolbar was not a standard component of Windows 3.11. Under Windows 3.11 it was implemented by constructing a row of push buttons, each being the same size and having a bitmap displayed in it. These were technically called owner draw buttons. Cobol-WOW does not support owner draw buttons. This means a toolbar created using Cobol-WOW can only contain text in the buttons.

Because of the popularity of the toolbar, however, Microsoft has made it one of the 32-bit Common Controls, added to Windows 95, Windows 98, and Windows NT 3.51 and higher. By making a specific toolbar control, Microsoft made it much easier to use, and provided the ability to automatically place text and/or graphics on each button. In addition, the entire toolbar can be managed as a single entity, rather than a group of separate buttons.

The next release of Cobol-WOW provides support for the toolbar control.

Q: How can I center a form?

A: The position required to center a form will depend on the form size and on the currently configured screen resolution. It is easy to retrieve the form Width and Height properties at runtime, and also easy to change the Top and Left properties to a new value, but how do you know what the video resolution is?

The GetDeviceCaps demonstration program, available for download from the website, demonstrates how to retrieve these values. Once you have this, it is just straightforward math to compute the new Top and Left property values.

In fact, since you can retrieve the Height and Width properties easily at runtime, with just the form handle, you can create a called utility program that performs the centering function, passing it just a form handle!


Home | About | Products | Contact
Distributors | Library | Register

Copyright 1997 by England Technical Services, Inc. All Rights Reserved