FILE_SELECT_MENU
Creates a menu composed of selectable file names from a list of directories and subdirectories. Can be instantiated alone or within a POPUP_MENU or MENU_ITEM. The menu can store the selected file path and name into a string, and also exposes a read/write index parameter to set or get the selected item number in the flattened files list.
If the file path is set programmatically, the corresponding menu item is automatically selected (if found) and the index parameter is updated.
Attributes brief detailed show all inherited
Example
Here we use menu to select a file located in one of directories listed. Using root_path to truncate (shorten) the resulted file path.
- <!-- file select menu -->
- <FILE_SELECT_MENU id="demo_file_select_menu"
- directories="$PLUGIN_USER_DOCUMENTS_PATH$Skins;$PLUGIN_USER_DOCUMENTS_PATH$Scripts"
- root_path="$PLUGIN_USER_DOCUMENTS_PATH$../.."
- file_types="*.xml;*.cxx" file_path_string_id="demo_file_path" file_name_string_id="demo_file_name"
- name="Select file" scan_on_load="false" />
- <!-- strings to save selection results -->
- <STRING id="demo_file_path" default="" />
- <STRING id="demo_file_name" default="" />
- <!-- trigger when item is selected -->
- <ACTION_TRIGGER event_id="demo_file_select_menu.item_selected" script="color_box.background_color.g=0.7;" requires="color_box.background_color.g;file_select_menu_demo1.selected_file_index" />
- <!-- layout -->
- <ROW spacing="10">
- <WIDGET id="color_box" background_color="#000000" width="10" height="15" />
- <TEXT value="Open menu" font_weight="bold">
- <INVISIBLE_ACTION_BUTTON action_id="demo_file_select_menu.Popup" width="100%" height="100%"/>
- </TEXT>
- </ROW>
- <!-- click to reload/scan files -->
- <SYSTEM_ACTION_BUTTON action_id="demo_file_select_menu.Refresh" />
- <!-- display/change selected file index -->
- <PARAM_TEXT_CONTROL param_id="demo_file_select_menu.selected_file_index" content="selected file index: {value}" value_format="0.0" />
- <!-- selected file name and path (minus root_path) -->
- <TEXT string_id="demo_file_name" font_size="11" />
- <TEXT string_id="demo_file_path" font_size="11" />

You can also use FILE_SELECT_MENU inside other POPUP_MENU or MENU_ITEM.
Comments
Please, authorize to view and post comments.