Function fltk::app::quit

source ·
pub fn quit()
Expand description

Quit the app

Examples found in repository?
examples/editor.rs (line 91)
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
fn quit_cb() {
    STATE.with(|s| {
        if s.saved {
            app::quit();
        } else {
            let c = dialog::choice2_default(
                "Are you sure you want to exit without saving?",
                "Yes",
                "No",
                "",
            );
            if c == Some(0) {
                app::quit();
            }
        }
    });
}
More examples
Hide additional examples
examples/spreadsheet.rs (line 177)
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
fn main() {
    let app = app::App::default().with_scheme(app::Scheme::Gtk);
    let mut wind = window::Window::default().with_size(800, 600);
    // We need an input widget
    let mut inp = input::Input::default();
    inp.hide();

    let mut table = MyTable::new(inp.clone());

    wind.make_resizable(true);
    wind.end();
    wind.show();

    wind.handle(move |_, ev| match ev {
        enums::Event::KeyDown => {
            if app::event_key() == enums::Key::Enter {
                // Press enter to store the data into the cell
                let c = table.cell.borrow();
                table.data.borrow_mut()[c.row as usize][c.col as usize] = inp.value();
                inp.set_value("");
                inp.hide();
                return true;
            }
            table.redraw();
            false
        }
        _ => false,
    });

    wind.set_callback(|_| {
        if app::event() == enums::Event::Close {
            // Close only when the close button is clicked
            app::quit();
        }
    });

    app.run().unwrap();
}