Difference between revisions of "VN fnc showMultipleOptionsModal"

From Savage Game Design Wiki
Jump to navigation Jump to search
m (Text replacement - "]]; |p1n=" to "]] |p1n=")
(Page filling)
 
Line 1: Line 1:
[[Category:TODO]]
 
 
{{Function
 
{{Function
  
Line 8: Line 7:
 
|a=
 
|a=
  
|e=
+
|e= local
  
 
|g1= multipleOptionsModal
 
|g1= multipleOptionsModal
  
|d= <pre>/*
+
|d= Opens up a modal dialog that allows for single or multiple choices.
File: fn_showMultipleOptionsModal.sqf
 
Author: Heyoxe
 
Date: 2020-09-19
 
Last Update: 2020-11-07
 
Public: Yes
 
  
Description:
+
|s= [title, options, onExit, singleChoice] call [[VN_fnc_showMultipleOptionsModal]]
Opens up the modal dialog.
 
  
Parameter(s):
+
|p1n= title
_title - Title of the vote [String]
+
|p1t= string
_options - String array of options [[_optionTitle, _optionAction,_optionArguments][]]
+
|p1d= title of the vote
_onExit - Function called when a player exits the modal, a nested array is passed to the function. Nested array is as follow: [_this: See OnUnload EH, _selected: Array of selected option indexes] [Code]
+
|p1v=
_radio - Do the options act as radio buttons (only 1 can be selected) or normal checkboxes (multiple can be selected) [Boolean, defaults to TRUE]
 
  
Returns:
+
|p2n= options
Was the dialog successfully created. Functions fails when you provide an empty title, or no options [BOOLEAN]
+
|p2t= {{DataType|array}} of {{DataType|string}}
 
+
|p2d= options items are in format [title, action, arguments]:
Example(s):
+
* title: {{DataType|string}}
[
+
* action: {{DataType|code}}
"Do you like pineapple on pizza? ",
+
* arguments: {{DataType|array}}
[
+
|p2v=
["Yes", { systemChat str _this; }, []],
 
["No", { systemChat str _this; }, []],
 
["No, but I never tried", { systemChat str _this; }, []],
 
["Yes, but I never tried", { systemChat str _this; }, []],
 
["I am neutral", { systemChat str _this; }, []]
 
],
 
{ systemChat str _this; },
 
true
 
] call VN_fnc_showMultipleOptionsModal;
 
*/
 
  
</pre><small>''(Placeholder description extracted from the function header by '''LM_exportFunctionsToWiki.sqf''')''</small>
+
|p3n= onExit
 +
|p3t= code
 +
|p3d= function called when a player exits the modal, a nested array is passed to the function. Nested array is as follow: [_this: See {{Biki|User_Interface_Event_Handlers#onUnload|OnUnload EH}}, _selected: Array of selected option indexes]
 +
|p3v=
  
|s= [] call [[VN_fnc_showMultipleOptionsModal]]
+
|p4n= singleChoice
 
+
|p4t= boolean
|p1n=
+
|p4d= if set to {{Biki|true}}, options act like a radio button (only one option can be selected); {{Biki|false}} allows to select multiple options.
|p1t=
+
|p4v= {{Biki|true}}
|p1d=
 
|p1v=
 
 
 
|p2n=
 
|p2t=
 
|p2d=
 
|p2v=
 
  
|r1t=
+
|r1t= boolean
|r1d=
+
|r1d= {{Biki|true}} if the dialog was successfully created. Empty title or no options will return {{Biki|false}}
  
|x1= <code>-</code>
+
|x1= <code>[
 +
"Do you like pineapple on pizza?",
 +
[
 +
["Yes", { systemChat str _this; }, []],
 +
["No", { systemChat str _this; }, []],
 +
["No, but I never tried", { systemChat str _this; }, []],
 +
["Yes, but I never tried", { systemChat str _this; }, []],
 +
["I am neutral", { systemChat str _this; }, []]
 +
],
 +
{ systemChat str _this; },
 +
true
 +
] call [[VN_fnc_showMultipleOptionsModal]];</code>
 
}}
 
}}

Latest revision as of 14:24, 30 January 2021

← back to Functions Introduced in S.O.G. Prairie Fire v1.00
by Heyoxe
Argument(s): n/a
Effect(s): local

Description

Opens up a modal dialog that allows for single or multiple choices.

Syntax

Syntax
[title, options, onExit, singleChoice] call VN_fnc_showMultipleOptionsModal
Parameters
title: String - title of the vote
options: Array of String - options items are in format [title, action, arguments]:
onExit: Code - function called when a player exits the modal, a nested array is passed to the function. Nested array is as follow: [_this: See OnUnload EH, _selected: Array of selected option indexes]
singleChoice: Boolean - (Optional, default true) if set to true, options act like a radio button (only one option can be selected); false allows to select multiple options.
Return value
Boolean - true if the dialog was successfully created. Empty title or no options will return false

Examples

Example 1
[ "Do you like pineapple on pizza?", [ ["Yes", { systemChat str _this; }, []], ["No", { systemChat str _this; }, []], ["No, but I never tried", { systemChat str _this; }, []], ["Yes, but I never tried", { systemChat str _this; }, []], ["I am neutral", { systemChat str _this; }, []] ], { systemChat str _this; }, true ] call VN_fnc_showMultipleOptionsModal;