Re: Gtk::Label doesn't refresh..



Hello,

you could either run this code

while( Gtk::Main::events_pending() )
        Gtk::Main::iteration (false);

everytime after the set_text call,

or instead

label.invalidate ();
label.update ();

to force iredrawing immediately only fo rthe label.

Greetings,
Luca

Ramashish Baranwal wrote:
Hi,

I am trying to change the text of a Gtk::Label object with set_text.
But it doesn't get refreshed on the UI. The following is the code
snippet-

void LoginWindow::on_button_login()
{
    m_LabelStatus.set_text("Signing in..");

    Glib::ustring user = m_EntryUser.get_text();
    Glib::ustring passwd = m_EntryPasswd.get_text();

    if(m_LoginSignal.emit(user, passwd))        // login succeeded
        hide();                                 // return to caller

    // login failed, let the user try again..
    sleep(1);
    m_LabelStatus.set_text("Incorrect username or password!");
}

The function is called when the user presses the Login button. Before
it the m_LabelStatus has the text "Sign in" which I want to get
changed to "Signing in.." when the user attempts to logon.
Can I force the changed text to appear "immediately" on Gtk::Label?

Thanks
Ram
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list





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