Skip to main content

Dial_SetPopup (function reference)

By November 1, 2020June 23rd, 2021Online Help, Troi Dialog Plug-in
Troi Dialog Plug-in for FileMaker Pro

Dial_SetPopup

Sets the values to be used for the popup list.

SyntaxFunction badge

Dial_SetPopup ( switches ; popupvalues {; secondvaluelist} )

Parameters

switches specifies which popuplist is set
popupvalues the list of text strings to be used. Separate each item with a return "¶"
secondvaluelist (optional) second list of text, to be shown to the user, while returning the selected value from the first list

Switches

Switches must be one of these:

-Popup1 set popup list 1
-Popup2 set popup list 2
-Popup3 set popup list 3
-Popup4 set popup list 4

-Popup18 set popup list 18
-Popup19 set popup list 19
-Popup20 set popup list 20

Returned Result

Data type returned

Error code

Result

An error code. Currently the plug-in always returns 0.

Originated in

Troi Dialog Plug-in 3.0

Compatibility

FileMaker Pro 16 to 19

Considerations

If you put a hyphen “-” on a separate line as a popupitem then the popup shown in the input dialog will have a separator line.

The popupvalues of this popup are saved by the plug-in until you set this popup again. So you only have to set a popup once if you want to use the same popup list for the same field in multiple dialogs. When the FileMaker application stops, the popups are reset to “”.

You can limit to specifying the popups you will be using, for example popup 3 and popup 5.

Note that the number of separate popupvalues is limited to 2048. Each item can be up to 255 characters. If no items are given the popup will be disabled (grayed out).

Note: you can display popup values from a second value list. The selected value from the first popup value list is returned. You can use this for example with a list of ItemIDs and a list of ItemDescriptions. The descriptions are shown to the user, while the itemID is returned.

Example

Set Field [ gErrorCode ; Dial_SetPopup ( "-Popup2" ; "Patrick¶Jonathan¶Brent¶-¶Guest" ) ]

This will set popup list 2 to:
Patrick
Jonathan
Brent

Guest

All next input dialogs, which have a popup as field 2, will use this list.

Example 2

This example will show an input dialog with 2 popup lists. The first list is filled from a field. The second is filled from a valuelist. We assume that in your FileMaker file a value list “PopupValues” is defined and also the following fields:

gErrorCode     		Global, text
gPopupData     		Global, text
gInputText1     	Global, text
gInputText2     	Global, text
gResult     		Global, text

Add the following script steps:

Set Field [ gErrorCode ; Dial_SetPopup ( "-Popup1" ; gPopupData ) ]
Set Field [ gErrorCode ; Dial_SetPopup ( "-Popup2" ; 
			ValueListItems ( Get ( FileName ) ; "PopupValues" ) ) ]
Set Field [ gResult ; Dial_SetInput ( "-Unused" ; gInputText1 ; gInputText2 ; ) ]
Set Field [ gResult ; Dial_InputDialog ( "-NoteIcon -Popup1 -Popup2" ; 2 ; 
			"Please enter your personal data:" ; "OK" ; "Cancel" ; ) ]

Note that the popups are preselected with the values from gInputText1 and gInputText2, if that text is present in the list of possible choices.

Example 3

Say you have a database with items with an ItemID and ItemDescriptions. You want to show the ItemDescriptions to the user, while getting the ItemID back as a result. Set the popup as follows:

Set Variable [ $ErrorCode ; Dial_SetPopup ( "-Popup1" ; 
	"ST0001¶ST0002¶ST0003¶-¶ST0040" ; // = first itemIDs, not shown in the dialog
	"Pen¶Pencil¶Biro¶-¶Stapler"  // = the main text, which will be shown in the popup
	) ]

In the Dial_InputDialog the popup shows the descriptions to the user, while the selected itemID is returned.

Example 4

To clear the values from a popup list use a command like this:

Set Field [ gErrorCode ; Dial_SetPopup ( "-Popup2" ; "" ) ]

This will set the popup list 2 to an empty value.

Used in example file

Input.fmp12

Related functionsFunction badge

Dial_GetPopup
Dial_InputDialog

Related topics

Troi Dialog Plug-in online help (overview)


Online Help Page for Troi Dialog Plug-in for 16 to 19 –> Dial_SetPopup (dialp4315) 2021-0623 15:57:11