Re: date/time in statusbar
- From: Jason Burchfield <jason burchfield cas-inc com>
- To: "Foster, Gareth" <gareth foster siemens com>
- Cc: Anca Mitrica <ancamitrica yahoo com>, gtkmm-list gnome org
- Subject: Re: date/time in statusbar
- Date: Mon, 11 Jul 2005 13:38:26 -0500
Foster, Gareth wrote:
Maybe you need to use a Glibmm timeout/callback? It goes something like ...
Glib::timeout_signal.connect(sigc::memfunc(*this, &MainPage::checkTime),
1000);
Look up the Glibmm docs on http://gtkmm.org for the full documentation.
Cheers,
Gaz
-----Original Message-----
From: Anca Mitrica [mailto:ancamitrica yahoo com]
Sent: 11 July 2005 13:59
To: gtkmm-list gnome org
Subject: date/time in statusbar
Hello,
I am working on an Gtkmm application that demands the
current date/time in the application statusbar. I am
able to take the current time and put it in the
statusbar, but when I'm trying to display the current
time dynamically into the status bar, i get a
segmentation fault.
I am "using g_timeout_add" function to call at each
second the function that put time in the status bar.
Here is the code :
gboolean MainPage::checkTime(void){
time_t timp;
time(&timp);
Glib::ustring strtime(ctime(&timp));
// cout<<strtime<<endl;
status.statusBar->pop();
Gtk::Label *timeLabel = new Gtk::Label(strtime);
status.statusBar->pack_end(*timeLabel,
Gtk::PACK_SHRINK);
status.statusBar->push(strtime);
return true;
}
..............................................
g_timeout_add(1000,(GSourceFunc)checkTime(),NULL);
Can anyone tell me what is wrong with my code or give
me an idea how to do this?
Thank you .
Anka
____________________________________________________
Sell on Yahoo! Auctions - no fees. Bid on great items.
http://auctions.yahoo.com/
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list
Your problem could be because the time function returns a string with a
'\n' character at the end. You may need to remove it.
Jason
--
Jason Burchfield
CAS, Inc.
(256) 971-6096
Jason Burchfield cas-inc com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]