ltk

Module file_chooser

Source
Expand description

A dialog that picks a file to open, or a folder and a name to save one as, over crate::files, alike natively and in a browser. The app holds it, puts its FileChooser::view in its own view, and hands its messages to FileChooser::update, which says when the user chose.

fn open( &mut self )
{
    self.chooser = Some( FileChooser::open( &self.sender, Msg::Chooser ).filter( &[ "text/*" ] ) );
}

fn update( &mut self, msg: Msg )
{
    let Msg::Chooser( msg ) = msg;
    let Some( chooser ) = &mut self.chooser else { return };
    match chooser.update( msg )
    {
        Some( Chosen::Path( path ) ) => { self.chooser = None; /* read path */ }
        Some( Chosen::Cancelled )    => self.chooser = None,
        None                         => {}
    }
}

Structs§

Enums§

Constants§

  • The field with the name of a folder to create.
  • The field with the name to save as.

Functions§

  • The user’s home folder, or in a browser where its folders are mounted.