Re: Immediately updating status bar



Try to iterate Gtk::Main while has pending events...

On 05/16/2012 01:00 PM, gtkmm-list-request gnome org wrote:
Date: Tue, 15 May 2012 17:08:43 +0200
From: jody <jody xha gmail com>
To: gtkmm-list <gtkmm-list gnome org>
Subject: Immediately updating status bar
Message-ID:
	<CAKbzMGdUF1JofUySzd734Ud_jsOMdYMSyWAfgZNJ+cHZRzfw9A mail gmail com>
Content-Type: text/plain; charset=ISO-8859-1

Hi

I have a window with some buttons and a status bar.
When i click one of the buttons this starts a lengthy operation.
I would like to have a  message like "loading data..." appear
on the status bar as soon as i press the button.

This is what i do:

void IQWin::on_button_load_data_clicked() {
    m_Status.push("loading data...");
    while (Gtk::Main::events_pending ())
    {
        Gtk::Main::iteration ();
    }

    m_IQScene.loadData(m_txtDataFile.get_text().c_str());
}

But that way the message on the status bar only appears when
the function has completed (after all the data has been loaded).

I guess by starting a thread which does the loading i could solve this problem,
but is there a more simple way to do this?

Thank You
  Jody

Luis Vaz



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]