Re: GtkProgessBar Example ??
| From: | Holger Banko | Date: | Fri, 17 May 2002 08:57:50 +0000 |
| Subject: | Re: GtkProgessBar Example ?? | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2007@lists.php.net to get a copy of this message | ||
Hi Steph,
> but GtkAdjustments are complicated animals, I know. What exactly is it
> that you're having problems with, can you explain it better? Show that
> part of your code, maybe?
here is my code. Sorry for my bad programming skills ;-). I tested a lot with
diffierent value ranges. This ist last version where I stopped.
I don't need to do a refresh ?
// Textschleife
foreach($txt as $txt_word) {
$pbar++;
$value=((100*$pbar)/$abc)/100;
print $value."*";
update_bar();
// Wortschatzschleife
foreach($words as $words_word) {
if(strlen($words_word) >= 2) {
$t=strtolower($txt_word);
$s=similar_text($t, $words_word, &$p);
// if((strtolower($txt_word))==$words_word) {
if($p>$sharpness) {
$hit=1;
break;
}
}
}
if($hit!="1") {
echo " <b>$txt_word</b> ";
$notfound++;
} else {
echo " $txt_word ";
$hit=0;
$found++;
}
}
...
// Progressbar
$adjustment = &new GtkAdjustment(0.01, 0.0, 1.0, 0.0, 0.0, 0.0);
$value = $adjustment->value;
$progressbar = &new GtkProgressBar($adjustment);
$progressbar->set_show_text(true);
$progressbar->set_text_alignment(0.02, 1.0);
// $progressbar->set_activity_mode(true);
$progressbar->set_format_string("%v%% complete");
$progressbar->set_usize(gdk::screen_width()/2, 30);
$grid->attach($progressbar, 0, 2, 4, 5);
> ----- Original Message -----
> From: "Holger Banko" <holger.banko@pgam.com>
> To: <php-gtk-general@lists.php.net>
> Sent: Friday, May 17, 2002 8:10 AM
> Subject: [PHP-GTK] GtkProgessBar Example ??
>
>
> Hello,
>
> I have tested a little bit with the Progressbar. I had no real success. The
> example in the documentation was not very helpful. It is working but when I
> try to apply a progressbar to my Program I have no success.
>
> I calculate in a loop how far the process is (in %) and want to tell the
> progressbar the percentage.
>
> I don't understand the adjustment and my problem was, that I just see 0% at
> the beginning of my loop and then just 100% at the end :-(. Is there are
> refresh function I have to call ??? Or is it easier to just draw a growing
> rectangle ?
>
> Help :-)
>
> --Holger
--
_____ _____ ____ _________
| _ || _ || _ || _ _ | Holger Banko
| |_| || |_| |||_| || | | | | | - Systemadministrator -
| ___||_ _, ||___ ||_| |_| |_| Telefon: 05401 / 490 - 194
| | ___| | Email: Holger.Banko@pgam.com
|_| |_____| http: www.pgam.com
Advanced Technologies AG, Beekebreite 18 - 20, 49124 Georgsmarienhütte