Skip to content
This repository was archived by the owner on Feb 22, 2022. It is now read-only.

Plugin Entities Common Form

Paolo Roth edited this page Oct 3, 2018 · 1 revision

Alcadica.Develop.Plugins.Entities.Common

FormFieldType

Describes what kind of ui widget the app will show

  • Directory
  • File
  • Number
  • TextMultiple
  • Text

FormField

Is the base class for form elements

// parent form instance
public Form parent_form = null;
// field type (will change ui behaviour)
public FormFieldType field_type { get; set; }
// invoked each time a user changes the value
public signal void on_change (T value);
// invoked when the validity state changes
public signal void validity_state_did_change (bool state);
// determines if the form is valid or not
public bool is_valid { get; set; }
// form field label
public string field_label { get; set; }
// form field name
public string field_name { get; set; }
// the default value
public T default_value { get; set; }

// constructor
public FormField (string field_name, string field_label);

// subscribes a form element to an instance of Form
public void subscribe_to_form (Form form);
// resets current instance to `default_value`
public void reset ();

FormFieldDirectory

Describes a directory picker

FormFieldFile

Describes a file picker

FormFieldSelect

Describes a combobox

FormFieldText

Describes a text field

Form

Describes a form

// is the list of registered fields
public List<FormField> fields;
// determines if the form is valid
public bool is_valid { get; }
// the form title
public string title { get; set; }
// invoked each time a user changes a value
public signal void on_item_change (string name, FormField instance);
// invoked each time the validity state changes
public signal void on_field_validity_state_change (string field_name, FormField instance);
// adds a FormFieldDirectory to the current Form instance
public FormField add_directory (string name, string label);
// adds a FormFieldFile to the current Form instance
public FormField add_file (string name, string label);
// adds a FormFieldSelect to the current Form instance
public FormFieldSelect add_select (string name, string label);
// adds a FormField to the current Form instance
public FormField add_text (string name, string label);
// get a FormField<T> by a given name
public FormField? get_by_name (string name);
// resets the form to the initial state
public void reset ();

Clone this wiki locally