- Solution Name: Multiple Popups
- Software Version: v10
- Keywords: Displays. Modes. Popups.
Summary
Popups are useful tools for displaying additional information without redirecting the user to a new page. They are especially effective for showing lists of objects in a standardized way, ensuring a consistent and intuitive user experience.
In this example we are showing different ways to open a popup in a solution. The example also shows how to create reusable popup displays that can be opened side by side and mapped to different tags in the application.
Due to limitations with the OpenDisplay method, the first button will only function if the background is maximized.
Technical Information
There are three ways to open a popup in this example:
Through the method Client.OpenDisplay() run in the Codebehind.
Through the method Client.NewPopup() also run in the CodeBehind.
Through the method Display.<Display Name>.NewPopup() as an expression.
Through Client.OpenDisplay():
The OpenDisplay
method can be used to open any type of display, whether it’s a standard display, a popup, a dashboard, or a dialog box. You call this method by passing the following arguments:
Page name - as a String
Mnemonics to be used inside the popup - also as a String separated by a semi colon.
This method is versatile, allowing you to open any display at any given time. However, it has limitations: it will not function properly if a second popup is open and focused (meaning the last click was on the popup rather than the background screen). This occurs because, when multiple displays are open simultaneously, this method prioritizes opening the display in a layer further back, excluding the focused display.
In this example, the code snippet used to run the OpenDisplay
can be seen below.
@Client.OpenDisplay("PopupPID", "PID = PID1 ; NAME='PID 1'");
Through Client.OpenPopup():
The OpenPopup
method works similarly to OpenDisplay
; however, the layering order is different. Since the solution recognizes it as a popup, it will forcefully open the display in the front layer, ensuring it works as intended.
It also uses the same arguments as OpenDisplay
, as seen below.
@Client.NewPopup("PopupPID", "PID = @Tag.PID2 ; NAME='PID 2'");
Through Display.<Display Name>.NewPopup():
As the name suggests, this method works similarly to the Client version but in a more organized way. Since we aren’t passing the display name as a string, it’s considered a direct reference to the display and can be found in the Cross-Reference page. This approach is beneficial for maintenance and for keeping track of what resources are being used.
This time, since the display name is already included in the method, there’s no need to pass it as an argument, just the mnemonics that will be used with it. Also, this time we will run it as an expression to demonstrate the multiple ways these methods can be called.
Display.PopupPID.NewPopup("PID=Tag.PID3;NAME='PID 3'")
Reference Information
→ See Displays (Desktop and Web) for more information.
→ See Multiple Popups for more information.
In this section: