Skip to content

File Dropdown

George Joseph edited this page Nov 23, 2020 · 2 revisions

Derived from Element -> Widget -> Select

"File Dropdown" works somewhat like the File List widget except it lists the files in a "dropdown" select box. You can add actions to be triggered when a file is selected like "print" or "macro" or you can send the DUEUI.EVENTS.PRINT, DUEUI.EVENTS.RUN, or DUEUI.EVENTS.REFRESH events to this widget.

There's a convenience widget File Select that has this dropdown plus refresh and action buttons already defined.

{
	/*
	 * All attributes of Element, Widget, and Select
	 */

	"id": "print_files",
	"type": "file_dropdown",
	
	/* The default directory is "/gcodes" */	
	"directory": "/macros/",
	
	/*
	 * For the label, you can strip any "XX_" prefix from the
	 * front, and any ".g" or other suffix from the
	 * end.
	 */
	"strip_prefix": true,
	"strip_suffix": true,
	
	/*
	 * You can sort them by the "file"
	 * name which would include any "XX_" prefix,
	 * by the "label" after any of the "strip"
	 * transforms are done, or by the "date".
	 * You can also append the sort orders
	 * "asc" or "desc" with "asc" being the default
	 */
	"sort": "label,desc",
	
}
Clone this wiki locally