Popup Method

 

Description

 

Displays text in a pop-up message box.

 

PowerBASIC Syntax

 

METHOD Popup ( _

BYVAL bstrText AS STRING, _

OPTIONAL BYREF vSecondsToWait AS VARIANT, _

OPTIONAL BYREF vTitle AS VARIANT, _

OPTIONAL BYREF vType AS VARIANT _

) AS LONG

 

Arguments

 

bstrText

BSTR. String value containing the text you want to appear in the pop-up message box.

vSecondsToWait

Optional. VARIANT. Numeric value indicating the maximum length of time (in seconds) you want the pop-up message box displayed. If vSecondsToWait equals zero, the pop-up message box remains visible until closed by the user. If vSecondsToWait is greater than zero, the pop-up message box closes after vSecondsToWait seconds.

vTitle

Optional. VARIANT. String value containing the text you want to appear as the title of the pop-up message box. If you do not supply the argument vTitle, the title of the pop-up message box defaults to "Windows Script Host."

vType

Optional. VARIANT. Numeric value indicating the type of buttons and icons you want in the pop-up message box. These determine how the message box is used. To display text properly in RTL languages such as Hebrew or Arabic, add hex &H00100000 (decimal 1048576) to the vType parameter.

 

Return Value

 

LONG. Number of the button the user clicked to dismiss the message box. If the user does not click a button before vSecondsToWait seconds, a value of -1 is returned.

 

Remarks

 

The meaning of vType is the same as in the Microsoft Win32® application programming interface MessageBox function. The following tables show the values and their meanings. You can combine values in these tables.

 

Button Types

 

Value

Description

0

Show OK button.

1

Show OK and Cancel buttons.

2

Show Abort, Retry, and Ignore buttons.

3

Show Yes, No, and Cancel buttons.

4

Show Yes and No buttons.

5

Show Retry and Cancel buttons.

 

Icon Types

 

Value

Description

16

Show "Stop Mark" icon.

32

Show "Question Mark" icon.

48

Show "Exclamation Mark" icon.

64

Show "Information Mark" icon.

 

The previous two tables do not cover all values for vType. For a complete list, see the Microsoft Win32 documentation.

 

Value

Description

1

OK button

2

Cancel button

3

Abort button

4

Retry button

5

Ignore button

6

Yes button

7

No button

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

DIM pWsh AS IWshShell

DIM lBtnCode AS LONG

DIM vSecondsToWait AS VARIANT

DIM vTitle AS VARIANT

DIM vType AS VARIANT

 

pWsh = NEWCOM "WScript.Shell"

' Shows a popup window and waits for an answer during 7 seconds

vSecondsToWait = 7 AS LONG

vTitle = "Answer This Question:"

vType = 4 + 32 AS LONG

DIM strText AS STRING

lBtnCode = pWsh.Popup(UCODE$("Do you feel alright?"), vSecondsToWait, vTitle, vType)

SELECT CASE lBtnCode

  CASE  6 :  PRINT "Glad to hear you feel alright."

  CASE  7 :  PRINT "Hope you're feeling better soon."

  CASE -1 :  PRINT "Is there anybody out there?"

END SELECT

 

Valid XHTML 1.0 Transitional