This code places an Elementary file selector entry widget on a window, along with some other checkboxes.

Those are there just as knobs on the file selector entry\textquotesingle{}s state.

Here\textquotesingle{}s how we instantiate it\+:  
\begin{DoxyCodeInclude}
   ic = elm_icon_add(win);
   elm_icon_standard_set(ic, \textcolor{stringliteral}{"file"});
   evas\_object\_size\_hint\_aspect\_set(ic, EVAS\_ASPECT\_CONTROL\_VERTICAL, 1, 1);

   \textcolor{comment}{/* file selector entry */}
   fs\_entry = elm_fileselector_entry_add(win);
   evas\_object\_size\_hint\_align\_set(fs\_entry, EVAS\_HINT\_FILL, 0);
   elm_fileselector_path_set(fs\_entry, \textcolor{stringliteral}{"/tmp"});
   elm\_object\_text\_set(fs\_entry, \textcolor{stringliteral}{"Select a file"});
   elm_object_part_content_set(fs\_entry, \textcolor{stringliteral}{"button icon"}, ic);

   elm_box_pack_end(vbox, fs\_entry);
   evas\_object\_show(fs\_entry);

\end{DoxyCodeInclude}


Note that we set on it\textquotesingle{}s button both icon and label decorations. It\textquotesingle{}s set to exhibit the path of (and list the contents of, when internal file selector is launched) the {\ttfamily \char`\"{}/tmp\char`\"{}} directory, also, with \hyperlink{group__File__Selector__Entry_gaa6be3beb4e8dbc297c8e426ae0df4b53}{elm\+\_\+fileselector\+\_\+entry\+\_\+path\+\_\+set()}. What follows are checkboxes to exercise some of its A\+P\+I funtions\+:  
\begin{DoxyCodeInclude}
   ck = elm_check_add(win);
   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"editable selection"});
   elm_check_state_set(ck, elm_fileselector_is_save_get(fs\_entry));
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"changed"}, \_current\_sel\_toggle, fs\_entry);
   elm_box_pack_end(hbox, ck);
   evas\_object\_show(ck);

   ck = elm_check_add(win);
   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"\(\backslash\)"inwin\(\backslash\)" mode"});
   elm_check_state_set(ck, elm_fileselector_entry_inwin_mode_get(fs\_entry));
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"changed"}, \_inwin\_mode\_toggle, fs\_entry);
   elm_box_pack_end(hbox, ck);
   evas\_object\_show(ck);

   ck = elm_check_add(win);
   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"folders only"});
   elm_check_state_set(ck, elm_fileselector_folder_only_get(fs\_entry));
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"changed"}, \_folder\_only\_toggle, fs\_entry);
   elm_box_pack_end(hbox, ck);
   evas\_object\_show(ck);

   ck = elm_check_add(win);
   elm\_object\_text\_set(ck, \textcolor{stringliteral}{"expandable"});
   elm_check_state_set(ck, elm_fileselector_expandable_get(fs\_entry));
   evas\_object\_smart\_callback\_add(ck, \textcolor{stringliteral}{"changed"}, \_expandable\_toggle, fs\_entry);
   elm_box_pack_end(hbox, ck);
   evas\_object\_show(ck);

   evas\_object\_smart\_callback\_add(fs\_entry, \textcolor{stringliteral}{"file,chosen"}, \_file\_chosen, NULL);

\end{DoxyCodeInclude}


The checkboxes will toggle whether the file selector entry\textquotesingle{}s internal file selector\+:
\begin{DoxyItemize}
\item must have an editable text entry for file names (thus, be in \char`\"{}save dialog mode\char`\"{})
\item is to be raised as an \char`\"{}inner window\char`\"{} (note it\textquotesingle{}s the default behavior) or as a dedicated window
\item is to populate its view with folders only
\item is to expand its folders, in its view, {\bfseries in place}, and not repainting it entirely just with the contents of a sole directory.
\end{DoxyItemize}

Observe how the entry\textquotesingle{}s text will match the string coming from the {\ttfamily \char`\"{}file,chosen\char`\"{}} smart event\+:  
\begin{DoxyCodeInclude}
\textcolor{comment}{/* hook on the file,chosen smart callback */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_file\_chosen(\textcolor{keywordtype}{void}        *data,
             Evas\_Object *obj,
             \textcolor{keywordtype}{void}        *event\_info)
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *file = event\_info;

   \textcolor{keywordflow}{if} (file)
     printf(\textcolor{stringliteral}{"File chosen: %s\(\backslash\)n"}, file);
   \textcolor{keywordflow}{else}
     printf(\textcolor{stringliteral}{"File selection canceled.\(\backslash\)n"});
\}

\end{DoxyCodeInclude}
 Whenever you dismiss or acknowledges the file selector, after it\textquotesingle{}s raised, the {\ttfamily event\+\_\+info} string will contain the last selection on it (if any was made).

Try, also, to type in a valid system path and, then, open the file selector\textquotesingle{}s window\+: it will start the file browsing there, for you.

This is how the example, just after called, should look like\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/fileselector_entry_example_00}}
\end{DoxyImageNoCaption}


Click on the file selector entry to raise its internal file selector, which will be contained on an {\bfseries \char`\"{}inner window\char`\"{}}\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/fileselector_entry_example_01}}
\end{DoxyImageNoCaption}


Toggle the \char`\"{}inwin mode\char`\"{} switch off and, if you click on the file selector entry again, you\textquotesingle{}ll get {\bfseries two} windows, the original one (note the last selection there!)

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/fileselector_entry_example_02}}
\end{DoxyImageNoCaption}


and the file selector\textquotesingle{}s new one

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/fileselector_entry_example_03}}
\end{DoxyImageNoCaption}


Play with the checkboxes to get the behavior changes on the file selector entry. The respective A\+P\+I calls on the widget coming from those knobs where shown in the code already.

See the full \hyperlink{fileselector_entry_example_c}{source code} for this example. 