Dial_SetPopup (function reference)

By October 1, 2019 October 13th, 2019 Online 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

switchesspecifies which popuplist is set
popupvaluesthe 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:

-Popup1set popup list 1
-Popup2set popup list 2
-Popup3set popup list 3
-Popup4set popup list 4

-Popup13set popup list 13
-Popup14set popup list 14
-Popup15set popup list 15

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 14 to 18

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.

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 14 to 18 –> Dial_SetPopup (dialp4315) 2019-1013 19:59:07