Re: Refreshing window & other
- From: Chris Moller <cmoller redhat com>
- To: SMS WebMaster <sms 4-sms com>
- Cc: gtk-list gnome org
- Subject: Re: Refreshing window & other
- Date: Wed, 17 Sep 2003 20:44:00 -0400
I've used stuff with progress monitors like:
gboolean
update_progress_bar(double tp)
{
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progress_bar),
tp/progress_bar_max);
while (gtk_events_pending()) gtk_main_iteration();
return progress_rc;
}
which is called every so many cycles of the loop that does the work. (I
set "every so many cycles" such that the update gets called like 50
times over the course of the execution. If you call it too fast -- like
on every loop -- screwy things happen.)
I expect you can update a status bar the same way -- the critical thing
is the "while (gtk_events_pending()) gtk_main_iteration();" which
updates the display "on the fly" rather than waiting for the completion
of the process.
I'm not all that familiar with statusbar_push, but I expect an
over-write would be better than a push.
The returned progress_rc is set by a callback that catches the progress
bar cancel button, allowing the user to stop things if desired. You
could probably build a separate cancel button to do that.
You can check the existance of a file with the "stat" library function;
check the stat man page.
Chris Moller
Senior Tinker
Red Hat, Inc.
P.S. -- I haven't any idea what your native language is, but you seem to
be doing English better than most native English speakers.
SMS WebMaster wrote:
Hi
I am new in GTK programming and I think GTK is very nice and easy but I
have few question I hope if someone can answer any of them.
1. How can I refresh a window in my program to show some text in the
statusbar before my program do a big job. (In another word, how can I
make "DoEvents" in GTK like Visual Basic)
[code]
gtk_statusbar_push(statusbar,Sid,"Searching...");
system("find / -name *.log -print");
gtk_statusbar_push(statusbar,Sid,"Done");
[/code]
2. Where can I download http://www.gtk.org/tutorial/ in html format.
(the URL ftp.gtk.org/pub/ can't be found !!!)
3. How can I check if a file exist. (Is there any function in GTK to do
that. if not then please how can I do it in C)
4. How can I put a text from clipboard to a text box (and make sure that
the clipboard contain a text).
Thank you and sorry for my poor english.
_______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]