Microsoft KB Archive/40080

= Closing Active Macintosh Window Doesn't Activate Other Window =

Article ID: 40080

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 1.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Interpreter 2.0
 * Microsoft BASIC Interpreter 2.1 for Macintosh
 * Microsoft BASIC Interpreter 3.0 for Macintosh

-



This article was previously published under Q40080



SUMMARY
In a Macintosh BASIC application that uses multiple windows, when the current active window is closed, another window is not automatically activated. EDIT FIELDs appear as if they are waiting for input, but keystrokes are not accepted because the WINDOW is not yet active. Your program must activate the desired window with the WINDOW n statement.

This information applies to Microsoft QuickBASIC Version 1.00, BASIC Compiler Version 1.00, and BASIC Interpreter Versions 2.00, 2.10, and 3.00 for the Apple Macintosh.



MORE INFORMATION
Your program can trap dialog events (such as the closing of a window) with the ON DIALOG GOSUB statement, which jumps to a specified subroutine when the event occurs. In the event-handling subroutine, you can invoke the DIALOG(0) function, such as x=DIALOG(0), and test x to find out what kind of dialog event has occurred. If DIALOG(0) returns a value of 4, it means that a window was closed. The DIALOG(4) function returns the number of the window that was closed. Based on this information, your program can activate one of the other remaining windows using the following statement, where n is the number of the window to activate:

WINDOW n

The following QuickBASIC program creates two windows, and when the second window is closed, the first window becomes the active window: ON DIALOG GOSUB closew DIALOG ON WINDOW 2,&quot;Test Window 1&quot;,(10,30)-(200,200),1 EDIT FIELD 1,&quot;&quot;,(1,50)-(50,70),1 WINDOW 3, &quot;Test Window 2&quot;,(100,100)-(350,350),1 EDIT FIELD 2,&quot;&quot;,(110,150)-(150,170),1 WHILE 1:WEND END closew: IF DIALOG(0) <> 4 THEN RETURN ELSE WINDOW 2 RETURN ENDIF

Additional query words: BasicCom MQuickB

Keywords: KB40080

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.