This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Content Creation
Content Optimization
Materials
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.WidgetDialogFile Class

Inherits from: WidgetDialog

This class creates dialog window where a file is selected. On the left side file-related information or an image preview is displayed.

Example#

The following C# component illustrates how to create a file selection dialog widget and use it to select files.

CFileDialog.cs

Source code (C#)
// ...

public class CFileDialog : Component
{
	// widgets to be used and callback functions for them
	WidgetLabel file_name;
	WidgetButton open_button;
	WidgetDialogFile file_dialog;
	// callback to be fired on clicking the button displaying the file dialog
	void on_button_clicked()
	{
		// resetting file sepection, showing the dialog and setting permanent focus to it
		file_dialog.File = "";
		file_dialog.Hidden = false;
		file_dialog.SetPermanentFocus();
	}

	// callback to be fired on clicking the Ok button of the file dialog
	void dialog_ok_clicked()
	{
		// getting the current path selection fron the dialog and checking if the file exists
		String path = file_dialog.File;
		if(!FileSystem.IsFileExist(path))
			return;
		
		// if the file exists hiding the dialog, displaying the selected file on the "file_name" label and removing focus
		file_dialog.Hidden = true;
		file_name.Text = path;
		file_dialog.RemoveFocus();
	}

	// callback to be fired on clicking the Cancel button of the file dialog
	void dialog_cancel_clicked()
	{
		file_dialog.Hidden = true;
		file_dialog.RemoveFocus();
	}
	private void Init()
	{
		// getting a pointer to the system GUI
		Gui gui = Gui.Get();
		
		// creating a label widget to display the file selected via the dialog
		file_name = new WidgetLabel(gui, "No file selected yet");
		gui.AddChild(file_name, Gui.ALIGN_TOP | Gui.ALIGN_BACKGROUND);
		
		// creating a button widget to display the file dialog
		open_button = new WidgetButton(gui, "Select an image file on disk");
		gui.AddChild(open_button, Gui.ALIGN_TOP | Gui.ALIGN_BACKGROUND);
		
		// setting "on_button_clicked" function to handle CLICKED event for the button
		open_button.AddCallback(Gui.CALLBACK_INDEX.CLICKED, on_button_clicked);

		// creating a file dialog widget and setting its caption, default path and file extensions filter to display only *.png and *.jpeg files
		file_dialog = new WidgetDialogFile(gui, "File open dialog");
		file_dialog.Path = "./";
		file_dialog.Filter = ".png.jpeg";

		// setting "dialog_ok_clicked" function to handle CLICKED event for dialog Ok button
		file_dialog.GetOkButton().AddCallback(Gui.CALLBACK_INDEX.CLICKED, dialog_ok_clicked);

		// setting "dialog_cancel_clicked" function to handle CLICKED event for dialog Cancel button
		file_dialog.GetCancelButton().AddCallback(Gui.CALLBACK_INDEX.CLICKED, dialog_cancel_clicked);

		// adding the created file dialog widget to the system GUI and hiding it
		file_dialog.Hidden = true;
		gui.AddChild(file_dialog, Gui.ALIGN_OVERLAP | Gui.ALIGN_CENTER);
	}
	
	private void Update()
	{
		// write here code to be called before updating each render frame
		
	}
}

WidgetDialogFile Class

Properties

string Filter#

The currently used file name filter.
set
Sets a file name filter, which is used to display files of required types only.
set value - List of file extensions with leading dots and without additional separators, for example: .mesh.smesh.

string Tabs#

A list of tabs in the file picker dialog. the tabs allow the user to interact several folders at once.
set
Adds a set of tabs to the file picker dialog. The tabs allow the user to interact with several folders at once.
set value - List of paths separated with semicolons. Each path corresponds to a tab.

string File#

The currently selected file.
set
Selects a given file in the file picker.
set value - Absolute or relative path to the file.

string Path#

The current path to the folder, contents of which is displayed in the file picker.
set
Sets a path to the folder, contents of which should be displayed in the file picker.
set value - Absolute or relative path.

Members


WidgetDialogFile ( Gui gui, string str = 0 ) #

Constructor. Creates a file picker dialog with given parameters and adds it to the specified GUI.

Arguments

  • Gui gui - GUI, to which the dialog will belong.
  • string str - Dialog title. This is an optional parameter.

WidgetDialogFile ( string str = 0 ) #

Constructor. Creates a file picker dialog with given parameters and adds it to the Engine GUI.

Arguments

  • string str - Dialog title. This is an optional parameter.
Last update: 2021-08-24
Build: ()