Popup Windows |
PxPlus provides a number of Popup window options through the utility object "*plus/obj/popup".
Often, it is desirable to have a window pop into view to advise a user about a condition that may require their attention. Many newer Windows applications use Popup advisory messages that appear in the lower right corner of the screen to advise users of everything from a new anti-virus download to chat users coming online.
Now you can add the same functionality easily within your application using the "*plus/obj/popup" object library. It provides functions to position and display windows using either "fade in/out" techniques or "Toaster" popup, which scroll up from the bottom right corner of the screen.
The "*plus/obj/popup" contains six methods that make displaying your popup window easy. These methods are:
Method |
Description |
Toast_up( ) |
Moves window to lower right corner and scrolls it up into view. |
Toast_down( ) |
Scrolls window down the screen until it drops from view. |
Fade_in( ) |
Takes current window (which should be hidden) and slowly fades it into view. |
Fade_out( ) |
Takes current windows and slowly fades it out of view. When fully transparent (invisible) the window is hidden with no transparency. |
Set_shape( ) |
Removes window frame and sets transparency mask to the window's background colour. |
Goto_corner( ) |
Moves the window to the lower right corner of the display. |
All of these methods can be invoked either as Methods (with no parameters) using the "*plus/obj/popup" object. For non-object oriented programmers, they can also be called directly (e.g. CALL "*plus/obj/popup.pvc;Fade_in").
The following program demonstrates the various capabilities of the PxPlus popup utility:
Part 1: |
First, create the window that we want to Popup. We do not want the main window because it has the menu_bar and background; therefore, we will hide it and create a Dialogue window. (Technically, any dialogue window will do, including windows created using NOMADS.) 0010 ! Create the Window to Popup Notice that we created the window and left it hidden. We do not want the user to see it before it 'Pops'. |
Part 2: |
Load the object library so that 'popobj' provides access the popup object. 0030 LET POPOBJ=NEW("*plus/obj/popup") |
Part 3: |
Now we will demonstrate the window scrolling up into view, then back out of view. 0050 ! Toaster style popup/down |
Part 4: |
This demonstrates the window fading in the out. First, we must hide the window from the user and move it to the corner of the screen using GOTO_CORNER. Once there, we can reveal it to the user. 0080 ! Fade in -- Hide first before moving into view area |
Part 5: |
This is a small demonstration using a Shaped Popup window. It first draws an oval on the screen and then shapes the window by removing anything in the default background window colour (WHITE in our case). Once the window is ready, we fade it into view then scroll it down off the screen. 0130 ! Change Window to become a red/blue oval |
Part 6: |
This demonstration simply creates a button on the screen and uses it as a shaped window. Once the button is displayed, it waits for the user to click it then fades from view. 0220 ! Set window to a become a button and wait for click |
Complete sample program below:
|