Table of Contents

Popup function

Description

Displays tabular data and allows user selection.

Note: As of Version 4.1.3, the popup() function has been modified to sort dates and any other output converted data correctly.

Syntax

result = Popup (ownerwindow, typeoverride[, name])

Parameters

The Popup function has the following parameters:

ParameterDescription
ownerwindowContains the name of the window from which to display the specified popup, typically @WINDOW.

Note: When using an MDIFrame, the ownerwindow will always be the frame regardless of the value passed to the variable.

Caution: If there is no window, Popup will use the screen. In this case, there is no modality and no values will be returned to your program.
typeoverrideAn @fm-delimited record containing the specification for the Popup, or override information if name is supplied.
nameThe name of the Popup stored in the repository, or null if the entire Popup definition is being passed in typeoverride.

A popup can be called either by

Repository("EXECUTE", popupentID, window [, typeoverride]);

- OR -

Popup (window, typeoverride, popupname).

Record structure

These column positions are defined in the POPUP_EQUATES insert record.

Column positionNameDescription
1colThe X position (in pixels) of the popup relative to its calling window, ownerwindow. If set to -1, the popup will center itself in ownerwindow. If set to -2, it will center itself on the screen. The default is -1.
2rowThe Y position (in pixels) of the popup relative to its calling window, ownerwindow. If set to -1, the popup will center itself in ownerwindow. If set to -2, it will center itself on the screen. The default is -1.
3widthThe number of visible columns in the popup window. Scroll bars will allow the user to access all other "cells" not shown within the confines of the popup window. A -1 will cause the popup to have a width equal to the total number of columns. Default is -1.
4heightThe number of visible rows in the popup window. Scroll bars will allow the user to access all other "cells" not shown within the confines of the popup window. A -1 will cause the popup to have a height equal to the total number of rows. Default is -1.
5bkcolorBackground color. An RGB @VM-delimited list is used (for example 255:@VM:0:@VM:0 is red, 0:@VM:255:@VM:0 is green).
6fontThe font to be used in the edit table.
For more information on this @svm-delimited structure, see Utility("CHOOSEFONT") and the FONT property.
7fileData source information; mode specific.

mode Value - Description
C, F, K, R, T - OpenInsight table name.
D - <7, 1>: DataSet name; <7, 2>: DataSet handle (allows an existing DataSet to be used as the data source for the Popup).
N - <7, 1>: Database Name; <7, 2>: "NOTESFORM" or "NOTESVIEW"; <7, 3>: @SVM-delimited list of forms/views; <7, 4>: For the form or view specified by <7,3,i>, an @TM-delimited list fields or columns is specified in <7,4,i>.
L - not applicable
8displayDetermines what information will be displayed; mode specific.

mode Value - Description
C - Cursor number 0-9 (0 is default)
D - <8, 1>: @SVM-delimited list of argument values; <8, 2>: @SVM-delimited list of corresponding argument names. If names are not supplied then argument numbers are assumed by position of argument values.
F - <8, 1>: OpenInsight Table Key; <8, 2>: Field Number.
K - @VM-delimited list of OpenInsight Table Keys.
L: @VM/@SVM-delimited array of literal data.
N - @VM- (as opposed to @FM) delimited SearchInfo record. (See "OpenNote() function" in Programmer's Reference Manual for details); - OR - Select script; for example "Select @all"; - OR -"USE" ViewName; for example "Use Contacts_by_Company".
R - OpenInsight Table Key.
T - Rlist selection and sorting criteria; for example "WITH COST < 100.00 BY COST".
9formatAn @VM/@SVM-delimited array of format information.

Parameter - Description
Field - Column name or number.
Width - Width of column (of characters).
text justification - L, R, or C.
heading justification - L, R, or C
Oconv - Output conversion pattern.
Heading - Heading text of column.
10modeSpecifies how the Popup gets its data.

mode - Description
C - The popup row corresponds to a record retrieved from a Native Tables cursor.
D - The popup row corresponds to a DataSet row.
F - The popup row corresponds to a value in a multi-valued field in an Native Tables record.
K - The popup row corresponds to a Native Tables record identified by the passed Key.
L - The popup row corresponds to an @SVM-delimited array element of display.
N - The popup row corresponds to a Lotus Notes document.
R - The popup row corresponds to a field from the specified table.
T - The popup row corresponds to a Native Tables record selected using Rlist.
11selectSpecifies how many items the user can choose.

Value - Description
0 - No selection.
1 - One selection (default).
2 - Multiple selections.
3 - Ordered multiple selections.
12titleCaption for the Popup.
13fieldUsed to return a field from a Native table or DataSet; used with type C or F.
14typeThis defines the return type of the Popup.

Parameter - Description
C - Column: Data from column field are returned (@VM-delimited list if multiple selections allowed). field specifies a column name (from the dictionary) or a number (as a column number in the row). Use C when you want to return data that is not displayed in the popup, but is part of each row.
E - Entire row: Entire row is returned. (Multiple rows are delimited by @FM.).
F - Popup field: Data from Popup column field are returned (@VM-delimited list if multiple selections allowed). field specifies a column number from the actual displayed data; i.e. column 1 is the first column in the Popup.
K - Row key: row key(s) of selected data (@VM-delimited list if multiple selections allowed). The Notes document ID is returned if the mode is N.
P - Row position: Row numbers of selected data are returned (@VM-delimited list if multiple selections allowed).
R - Read only: No value is returned.
15colhdr(Boolean) If TRUE, the column headings are visible on the Popup's edit table. Defaults to TRUE.
16rownum(Boolean) If TRUE, the row numbers are visible on the Popup's edit table. Defaults to TRUE.
17rowbtn(Boolean) If TRUE, the row buttons are visible on the Popup's edit table. Defaults to TRUE.
18hgrid(Boolean) If TRUE, the horizontal grid is visible on the Popup's edit table. Defaults to TRUE.
19vgrid(Boolean) If TRUE, the vertical grid is visible on the Popup's edit table. Defaults to TRUE.
20resize(Boolean) If TRUE, the columns in the Popup's edit table are resizeable. Defaults to TRUE.
21border(Boolean) If TRUE, borders are placed on the Popup's edit table. Defaults to TRUE.
22btnsbelow(Boolean) If TRUE, buttons are placed across the bottom, instead of on the right. Defaults to FALSE.
23search(Boolean) If TRUE, allows searching the Popup for a user specified value. Defaults to FALSE.
24sort(Boolean) If TRUE, allows column sorting. Defaults to FALSE.

Note: Right justified columns are sorted right-justified, all others are sorted left-justified.
25lockThe number of columns set to "scroll lock." Defaults to 0.
26user-definedThis column reserved for user-defined information; it is not set or altered by Popup Designer.
27subfileSecondary data source information; mode specific.

mode Value - Description
D - <27, 1>: DataSource name; <27, 2>: Connection Object handle (Supplied at runtime).
28initselect@VM list of row numbers to initially select when the Popup is executed.
29showmissing(Boolean) If TRUE, show the phrase 'Record Missing' in columns.
30print(Boolean) If TRUE, show the print button.
31showGauge(Boolean) If TRUE, display a gas gauge message when the system is populating the popup.
32captureEsc(Boolean) If TRUE, return CHAR(27) when the Cancel button in the Popup window is clicked.

Notes

For a Popup with mode D, when the Popup is executed it determines what data source to use in this order.

1. If a DataSet handle is passed in <7, 2> (file), then that DataSet is used.

2. If a Connection Object handle is passed in <27, 2> (subfile), then the DataSet is created and executed using that handle.

3. If a DataSource name is passed in <27, 1> (subfile), then a connection handle is created for that DataSource name using XOInstance and that handle is used to create and execute the DataSet.

Otherwise, the DataSource name specified in the DataSet Designer is used to create a connection which in turn is used to create and execute the DataSet passed in <7, 1> (File).

See Also

POPUP_EQUATES (Insert record).

Example

* Call a popup to Named 'EMP', fill in the EMP_NO control
* Use DEFPROP property, Send LOSTFOCUS event to trigger system events such as read or updating dependent controls
ans = popup(atWindow, '', 'EMP')
If ans Then
     Call Set_Property(atWindow:'.EMP_NO', 'DEFPROP', ans)
     Call Send_Event(atWindow:'.EMP_NO','LOSTFOCUS')
end
* Call a popup, override the definition to use a list of product keys related to this order

* Enable OI10 object notation for get, set property
#pragma precomp event_precomp

$insert popup_equates
declare subroutine send_Event
ctrl = atWindow:'.PRODUCT_CODE'
prod_codes = Xlate('ORDERS_REL', ordered, 'PRODUCTS', 'X')
override = ""
If prod_codes != null$ Then
     override<pMode$> = 'K' ; * list of keys
     override<pDisplay$> = prod_codes
     ans = popup(atWindow, override, 'SVC_CODE')
     If ans Then  
         @ctrl->DefProp = ans ; * same as set property
         Send_Event(object,'LOSTFOCUS')
    end
end
* Create a popup on the fly
* display a list stored in a user defined property

display = get_Property(atWindow, udp_route_list$)     
display_format = "1":@svm:"6":@svm:"R":@svm:"C":@svm:"":@SVM:"Route"

* Define the popup ( see POPUP_EQUATES )
def = ""
def<pTITLE$>     = 'Routes'
def<pMODE$>      = "L"                        ;* display will be literal data
def<pFORMAT$>    = display_format             ;* column format information (@vm delim'd by column, @svm by attribute) field, width, just, heading just, oconv, heading
def<pDISPLAY$>   = display                    ;* for mode 'L', the data to display, vm delimited by row, svm delimited by column
def<pGREENBAR$>  = true$                      ;* alternating colored rows in the display
def<pSEARCH$>    = true$                      ;* sortable
def<pSORT$>      = true$                      ;* searchable 
     
ans = Popup(atWindow, def)
If ans ne "" Then
     @CtrlEntID->Defprop = ans
     Call Send_Event(CtrlEntID, 'LOSTFOCUS')
end
* launch a popup next to the control
ctrl = atWindow:'.EF_FOR'
itemSize = @ctrl->Size
xPos = ( itemSize<1> + itemSize<3>)  ; * x + width
yPos = ( itemSize<2> )               ; * y

override = ""
override<pRow$> = yPos
override<pCol$> = xPos
ans = popup(atWindow, override, 'EMP')
If ans Then
     @ctrl->DefProp = ans
     Send_Event(ctrl,'LOSTFOCUS')
end