Both Windows Affect Each Other

Previous Next

Assume, one window contains a button that opens another window by performing a Window.Create() call. The window that contains the button is the calling window, and the window that is opened is the created window. After creation, both windows can affect each other; a two-way window interaction can be set up.

To set up a two-way window interaction:

1.From the Windows Designer catalog, open the to be created window.
2.Open the Object Activator.
3.In the object pane of the Object Activator, select the window object at the top.
4.Click the Properties tab page.
5.Click the New button.
6.Define a user-defined property of the calling window type. You are advised to use a consistent naming convention.

 

Example 1

Suppose, the calling Bookings window opens the to be created Days window. For the Bookings window, define a user-defined property UDPDays of type: Days.

1.In the calling window, insert a button, and set the Action property to:

user-defined-propertycreated-window( Self() ).Window.Create() )

 

This action statement:

Sends the calling window as value to the user-defined property of the created window, within the Self() keyword.

Implicitly opens the to be created window.

Fills the <UDPCreated> user-defined property with the created window.

In the Bookings and Days example, the corresponding action statement is:

UDPDays( Days( Self() ).Window.Create() )

 

2.From now on, both windows can affect each other.

 

Example 2

To set the background color of the Days window to red, insert a button in the Bookings window, and set the Action property to:

UDPDays.background( red )

 

To set the background color of the Bookings window to red, insert a button in the Days window, and set the Action propre to:

UDPBookings.background( red )

 

CAUTION: In this situation, if the user closes one of the two windows, the other window still contains a reference to the closed window in its user-defined property. To deal with this, refer to help topic: "Clearing the Reference To a Closed Window".

 

See Also

Permanent Window Interaction