pub enum Registration {
Function {
id: i16,
name: &'static str,
definition: &'static str,
description: &'static str,
min_args: i16,
max_args: i16,
display_in_dialogs: bool,
compatibility_flags: u32,
min_ext_version: ExternVersion,
min_fm_version: &'static str,
allowed_versions: AllowedVersions,
function_ptr: fmx_ExtPluginType,
},
ScriptStep {
id: i16,
name: &'static str,
definition: &'static str,
description: &'static str,
display_in_dialogs: bool,
compatibility_flags: u32,
min_ext_version: ExternVersion,
min_fm_version: &'static str,
allowed_versions: AllowedVersions,
function_ptr: fmx_ExtPluginType,
},
}Expand description
Register ScriptSteps and Functions for your plugin.
§Function Registration
Registration enables the function so that it appears in the calculation dialog in the application.
idis the unique id that you can use to represent which function was called, it will be passed back to the registered function as the first parameter (see the parameter of the same name infmx_ExtPluginType).nameis the name of the function as it should appear in the calculation formula.definitionis the suggested syntax that will appear in the list of functions in the calculation dialog.descriptionis the text that will display when auto-entered into the calculation dialog. The format is “type ahead word list|description text”.min_argsis the number of required parameters for the function.0is the smallest valid value.max_argsis the maximum number of parameters that they user should be able to specify in the calculation dialog and still have correct syntax usage for the function. Use-1to allow a variable number of parameters up to the number supported by calculation formulas in the application.compatible_flagssee bit flags above.function_ptris the pointer to the function that must match the signature defined byfmx_ExtPluginType. If you implementFileMakerFunctionfor your function, then you can just referenceMyFunction.extern_funchere.
§Script Step Registration
Registration::ScriptStep::definition must contain XML defining the script step options. Up to ten script parameters can be specified in addition to the optional target parameter. All the parameters are defined with <Parameter> tags in a <PluginStep> grouping.
The attributes for a <Parameter> tag include:
-
Type- if not one of the following four types, the parameter is ignoredCalc- a standard Specify button that brings up the calculation dialog. When the script step is executed, the calculation will be evaluated and its results passed to the plug-inBool- simple check box that returns the value of0or1List- a static drop-down or pop-up list in which the id of the item selected is returned. The size limit of this list is limited by the capabilities of the UI widgets used to display it. AListtype parameter expects to contain<Value>tags as specified belowTarget- will include a specify button that uses the newInsert From Targetfield targeting dialog that allows a developer to put the results of a script step into a field (whether or not it is on a layout), into a variable, or insert into the current active field on a layout. If noTargetis defined then the resultDataobject is ignored. If there are multipleTargetdefinitions, only the first one will be honored.
-
ID- A value in the range of0to9which is used as an index into theDataVectparms object for the plug-in to retrieve the value of the parameter. Indexes that are not in range or duplicated will cause the parameter to be ignored. A parameter of typeTargetignores this attribute if specified -
Label- The name of parameter or control that is displayed in the UI -
DataType- only used by theCalcandTargetparameter types. If not specified or not one of the six data types, the typeTextwill be usedTextNumberDateTimeTimestampContainer
-
ShowInline- value is either true or false. If defined and true, will cause the parameter to show up inlined with the script step in the Scripting Workspace -
Default- either the numeric index of the default list item or the true/false value for a bool item. Ignored for calc and target parameters
Parameters of type List are expected to contain <Value> tags whose values are used to construct the drop-down or pop-up list. The id of a value starts at zero but specific id can be given to a value by defining an ID attribute. If later values do not have an ID attributes the id will be set to the previous values id plus one.
Sample XML description:
<PluginStep>
<Parameter ID="0" Type="Calc" DataType="text" ShowInline="true" Label="Mood"/>
<Parameter ID="1" Type="List" ShowInline="true" Label="Color">
<Value ID="0">Red</Value>
<Value ID="1">Green</Value>
<Value ID="2">Blue</Value>
</Parameter>
<Parameter ID="2" Type="Bool" Label="Beep when happy"/>
</PluginStep>Variants§
Function
Fields
min_ext_version: ExternVersionallowed_versions: AllowedVersionsfunction_ptr: fmx_ExtPluginTypeScriptStep
Implementations§
Source§impl Registration
impl Registration
Sourcepub fn register(&self, plugin_id: &QuadChar) -> FMError
pub fn register(&self, plugin_id: &QuadChar) -> FMError
Called automatically by register_plugin!.
Sourcepub fn min_ext_version(&self) -> ExternVersion
pub fn min_ext_version(&self) -> ExternVersion
Returns minimum allowed sdk version for a function/script step.
Sourcepub fn min_fm_version(&self) -> &str
pub fn min_fm_version(&self) -> &str
Returns minimum allowed FileMaker version for a function/script step.
pub fn is_fm_version_allowed(&self, version: &ApplicationVersion) -> bool
Sourcepub fn unregister(&self, plugin_id: &QuadChar)
pub fn unregister(&self, plugin_id: &QuadChar)
Called automatically by register_plugin!.