User's Guide

Opening a modal window

You noticed in the previous section that the user is able to interact with the Road Race window while the Runner Data window is open. There will be many times when you want to prevent such user interaction. You can prevent this interaction by opening the view wrapper or window part as a modal window.

Try this by opening the settings on the defaultActionRequested to openWidget connection. Select openApplicationModalWidget from the list of actions and then select OK.

Save your part and test it again. Try interacting with the Road Race window while the Runner Data window is open. When you click inside the Road Race window, you should be unable to interact with it. While the Runner Data window is still open, try interacting with the Composition Editor or any other application you might have open. You should be able to interact with other applications and windows.

System modal windows

On very rare occasions you might need to prevent the user from interacting with any other windows on the system while your view wrapper is open. You can do this by opening the view wrapper or window part as a system modal window.

Try this by opening the settings on the defaultActionRequested to openApplicationModalWidget connection. Select openSystemModalWidget from the list of actions and then select OK.

Save your part and test it again. Try interacting with the Road Race window while the Runner Data window is open. You should hear a beep whenever you click inside the Road Race window and be unable to interact with it. While the Runner Data window is still open try interacting with the Composition Editor or any other application you might have open. You should be unable to interact with any VisualAge window until the Runner Data window is closed.

Opening a modal window from a script

When developing applications with VisualAge you might find it more convenient to open a window from a script.

In the Composition Editor delete the View Wrapper part and its connections. Switch to the Script Editor and create a selectedRunner: script as follows:

selectedRunner: aRunner
  "Set the Runner Data View to be the current runner
   and open the view wrapper as a modal window."
  | currentRunner |
  currentRunner := aRunner.
  RunnerDataView new 
      valueOfAttributeNamed: #runner
      put: currentRunner;
      openApplicationModalWidget.

Save your part and test it. You should be unable to interact with the Road Race window while the Runner Data window is open. However, you should be able to interact with other windows in the system.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]