Article ID: 57853 - View products that this article applies to.
This article was previously published under Q57853
This article has been archived. It is offered "as is" and will no longer be updated.
The WindowDo procedure of the WINDOW.BAS toolbox file that is included with Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS will not trap a click in the current window unless that click is in a button or edit field.
To work around this limitation, open an "area" button (button type 4) in the current window that is exactly the same size as the current window. This does not make the WindowDo procedure trap clicks in the current window (it is only trapping a click in a button), but it appears so because an area button is invisible.
The WindowDo procedure allows you to trap window events such as selecting buttons and edit fields, resizing, moving, or closing a window, and selecting a window other than the current window. However, WindowDo cannot trap a click in the current window itself unless the click occurs on a button or edit field in that window.
For example, suppose a program opens two windows. For simplicity, assume there are no buttons or edit fields opened in either window. By default, the last window opened (window2) is the current window. The WindowDo procedure will trap a click in the other window (window1) but not in window2. This is a design limitation of the WindowDo procedure and is not considered a problem.
To easily work around this situation, in the current window, open an area button (button type 4) that is exactly the same size as the current window. The WindowDo procedure is still trapping a click in a button, but it appears as if a click is being trapped anywhere in the window because the button is hidden. Type 4 buttons are invisible.
For a detailed explanation of the WindowDo procedure, see page 572 of the "Microsoft Basic Version 7.0: Language Reference" versions 7.0 and 7.1 manual. For more information on area buttons (button type 4), see the ButtonOpen procedure on page 557 of the same manual.
The following example program illustrates the limitation and its workaround:
Article ID: 57853 - Last Review: August 23, 2013 - Revision: 3.1
Contact us for more help
Connect with Answer Desk for expert help.