Closing Active Macintosh Window Doesn't Activate Other Window (40080)



The information in this article applies to:

  • Microsoft QuickBASIC 1.0
  • Microsoft BASIC Compiler
  • Microsoft BASIC Interpreter for Apple Macintosh 2.0
  • Microsoft BASIC Interpreter for Apple Macintosh 2.1
  • Microsoft BASIC Interpreter for Apple Macintosh 3.0

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,"Test Window 1",(10,30)-(200,200),1
EDIT FIELD 1,"",(1,50)-(50,70),1
WINDOW 3, "Test Window 2",(100,100)-(350,350),1
EDIT FIELD 2,"",(110,150)-(150,170),1
WHILE 1:WEND
END
closew:
IF DIALOG(0) <> 4 THEN
   RETURN
ELSE
   WINDOW 2
   RETURN
ENDIF
				

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB40080