Skip to content

File Select

George Joseph edited this page Jan 19, 2020 · 1 revision

Derived from Element -> Panel

"File Select" is a convenience widget made up of a File Dropdown and two optional Buttons that refresh the list and run an action on it.

Example with companion buttons

{
	/*
	 * All attributes of Element, Widget, and File Dropdown
	 */

	"id": "run_macro",
	"type": "file_select",
	
	/*
	 * See File Dropdown for the attributes that apply here.
	 */
	
	/*
	 * If you're listing macros, set action_type = "run"
	 *   This will cause the file to be run as a macro and
	 *   the action button to display "Run".
	 * If you're listing gcode files, set action_type = "print"
	 *   This will cause the file to be printed and
	 *   the action button to display "Print".
	 */
	"action_type": "run",
	
	/*
	 * Show the refresh button or not?
	 */ 
	"show_refresh_button": true,
	
	/*
	 * Show the action button or not?
	 */ 
	"show_action_button": true,

	/*
	 * You can customize the Refresh button.
	 * All Button attributes are available.
	 * You can omit this attribute if the defaults
	 * are acceptable.
	 * These are the defaults:
	 */ 
	"refresh_button": {
		"id": "run_macro_refresh",
		"type": "button",
		"icon": "replay",
		"style": {
			"height": "2.5em",
			"width": "5ch",
		},
		"classes": "btn-success",
		"position": {
			"my": "left top",
			"at": "right top",
			"of": "#run_macro,
		},
		"actions":
			{"type": "event", "event": DUEUI.EVENTS.REFRESH, "target": "#run_macro"}
	}

	/*
	 * You can customize the Action button.
	 * All Button attributes are available.
	 * You can omit this attribute if the defaults
	 * are acceptable.
	 * These are the defaults:
	 */ 
	"action_button": {
		"id": "run_macro_action",
		"type": "button",
		/*
		 * The default for "value" depends on the
		 * "action_type" specified above.
		 */
		"value": 
		"style": {
			"height": "2.5em",
			"width": "5ch",
		},
		"classes": "btn-success",
		"position": {
			"my": "left top",
			"at": "right top",
			"of": "#run_macro_refresh,
		},
		/*
		 * The default for "event" depends on the
		 * "action_type" specified above.
		 */
		"actions":
			{"type": "event", "event": DUEUI.EVENTS.RUN, "target": "#run_macro"}
	}
}

Clone this wiki locally