| Introduction |
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.
Demonstration program:
The following program demonstrates the various
capabilities of the PxPlus popup utility.
NOTE: When running under WindX it is desirable to execute
this logic on the workstation thus either instantiate the
object or call the program using
"[LCL]"/"[WDX]".
A number of features that
allow you to enhance the appearance of your application
and allow you to create widget-like applications with a
minimum of effort.
|
| Demonstration Program |
The
following program demonstrates the various capabilities
of the PxPlus popup utility.
| Part 1 |
First create the
window that we want to Popup. We don't want the main
window because it has the menu_bar and background
so 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
0020 PRINT
'DIALOGUE'(5,5,20,7,"test"),'SR','CS','SHOW'(-1),
Notice that we
created the window and left it hidden. We don't
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
0060 POPOBJ'TOAST_UP()
0070 POPOBJ'TOAST_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
0090 PRINT 'SHOW'(-1), ! Hide before moving
into view
0100 POPOBJ'GOTO_CORNER()
0110 POPOBJ'FADE_IN() ! Fade_in assumes
window is hidden
0120 POPOBJ'FADE_OUT() ! Fade_out leaves
window hidden once again
|
| Part 5 |
This is a small
demonstration using a Shaped Popup window. It
first draws an oval on the screen 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
0140 PRINT
'CS','FILL'(2,"RED","BLUE"),'CIRCLE'(@X(10),@Y(4),@X(8),1.25),
0150 PRINT
'TEXT'(@X(5),@Y(2),@X(15),@Y(6),"This is
text within a shaped
window","WC"),
0160 ! Set window shape to oval
0170 POPOBJ'SET_SHAPE()
0180 POPOBJ'GOTO_CORNER() ! Adjust position
due to removal of border
0190 POPOBJ'FADE_IN()
0200 WAIT 1
0210 POPOBJ'TOAST_DOWN()
|
| 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
0230 PRINT 'CS','4D',
0240 BUTTON 10,@(0,0,20,7)="Hit this
button"
0250 POPOBJ'TOAST_UP()
0260 WHILE 1
0270 OBTAIN (0)*
0280 IF CTL=10 THEN BREAK
0290 WEND
0300 POPOBJ'FADE_OUT()
|
| |
Complete
Sample Program below
0010
! Create the Window to Popup
0020 PRINT
'DIALOGUE'(5,5,20,7,"test"),'SR','CS','SHOW'(-1),
0030 LET
POPOBJ=NEW("*plus/obj/popup")
0040 PRINT
"TESTING",'LF',"*plus/obj/popup"
0050 ! Toaster style popup/down
0060 POPOBJ'TOAST_UP()
0070 POPOBJ'TOAST_DOWN()
0080 ! Fade in -- Hide first before
moving into view area
0090 PRINT 'SHOW'(-1), ! Hide before
moving into view
0100 POPOBJ'GOTO_CORNER()
0110 POPOBJ'FADE_IN() ! Fade_in assumes
window is hidden
0120 POPOBJ'FADE_OUT() ! Fade_out leaves
window hidden
0130 ! Change Window to become a red/blue
oval
0140 PRINT
'CS','FILL'(2,"RED","BLUE"),'CIRCLE'(@X(10),@Y(4),@X(8),1.25),
0150 PRINT
'TEXT'(@X(5),@Y(2),@X(15),@Y(6),"This
is text within a shaped
window","WC"),
0160 ! Set window shape to oval
0170 POPOBJ'SET_SHAPE()
0180 POPOBJ'GOTO_CORNER() ! Adjust
position due to removal of border
0190 POPOBJ'FADE_IN()
0200 WAIT 1
0210 POPOBJ'TOAST_DOWN()
0220 ! Set window to a become a button
and wait for click
0230 PRINT 'CS','4D',
0240 BUTTON 10,@(0,0,20,7)="Hit this
button"
0250 POPOBJ'TOAST_UP()
0260 WHILE 1
0270 OBTAIN (0)*
0280 IF CTL=10 THEN BREAK
0290 WEND
0300 POPOBJ'FADE_OUT() |
|
|