ClosePopupWithResult

Typestatement
DictionaryLCB
LibraryLiveCode Builder
Syntax
close popup [ returning <Result> ]
Associationscom.livecode.widget
Summary

Closes the current widget popup.

Parameters
NameTypeDescription
Result

An expression that evaluates to any type. The result of popping up this widget.

Example
variable mSelected

public handler OnClick()
	variable tOption
	put getOptionAtPosition(the click position) into tOption
	if tOption is not empty then
		put tOption into mSelected

		// If this widget is being used as a popup then we close the popup and return a value to the caller
		if currently popped up then
			if mSelected is "Cancel" then
				// Dismiss the popup without returning a value - the result will be nothing
				close popup
			else
				// Dismiss the popup - the result will be the value of mSelected
				close popup returning mSelected
			end if
		end if
	end if
end handler

private handler getOptionAtPosition(in pPosition as Point) returns String
	// Return the name of the option at the given point
	...
end handler
RelatedStatement: PopupWidget
Expression: IsPoppedUp
Description

Use to close the current popup, and optionally set a return value for the PopupWidget statement that launched it.

Tagswidget