Re: Scrolled Window Question...
| From: | Steph | Date: | Wed, 27 Mar 2002 12:33:28 +0000 |
| Subject: | Re: Scrolled Window Question... | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1662@lists.php.net to get a copy of this message | ||
Hi Tom,
I've done some horrible things to your script to get it working. Please read comments. Simon
was quite right :)
----- Original Message -----
From: <fire@firepages.org>
To: "phpgtk at bc90021.net" <phpgtk@bc90021.net>;
<php-gtk-general@lists.php.net>
Sent: Wednesday, March 27, 2002 8:43 PM
Subject: Re: [PHP-GTK] Scrolled Window Question...
> Ok - not sure if this was the problem in the first place :) ...(My First GTK
> answer - be gentle)
>
> I commented out the // $output_display = &new GtkText(); in the ping
> function as there appears no reason to recreate the GtkText() that already
> exists...
> sent the $output_display to the ping function..
>
> $ping_button->connect_object('clicked', 'ping', $scrolled_window,
> $ip,
> $ping_number,$output_display);
> ......
> function ping($scrolled_window, $ip_address,
> $ping_count,$output_display)
>
> and it worked fine for me apart from a very flickery redraw
>
> Was that the problem or have I missed the point (very possible)
> Regards,
> Simon Wheeler
> firepages
>
>
>
> ----- Original Message -----
> From: "phpgtk at bc90021.net" <phpgtk@bc90021.net>
> To: <php-gtk-general@lists.php.net>
> Sent: Tuesday, March 26, 2002 1:09 PM
> Subject: [PHP-GTK] Scrolled Window Question...
>
>
> > Hi all,
> >
> > I'm pretty new to PHP-GTK, and reasonably new to programming in general.
> > (I've used PHP for some web stuff, but never tried apps programming
> > before.)
> >
> > I have a program with a table, and the last thing I attach to my table
> > is a scrolled window, for output from a ping function. (Just a straight
> > exec of system ping.) I have the ping in a separate function that gets
> > called when the user clicks a button. What I'd like it to do is to
> > update the scrolled window in that second function, but no matter what I
> > try, I can't get it to work.
> >
> > Here's a quick pseudo-code example:
> >
> > <?php
> >
> > function ping (scrolled_window, ip, num)
> > {
> > //ip and num are gtkentries
> >
> > do ping here, get output
> > output_display is a gtktext
> >
> > for loop
> > output_display-> insert output
> >
> > output_scrolled_window = scrolled_window;
> > output_scrolled_window->hide();
> > output_scrolled_window->add(output_display)
> > output_scrolled_window->show();
> > }
> >
> >
> > function createtable(notebook)
> > {
> > create label
> > create gtkentry (ip)
> > create label
> > create gtkentry (num)
> > create gtkbutton
> >
> > this notebook = notebook
> >
> > create gtkscrolledwindow
> > scrolled_window->set_reallocate_redraws(TRUE)
> >
> > table->attach(label)
> > table->attach(gtkentry)
> > table->attach(label)
> > table->attach(gtkentry)
> > table->attach(button)
> > table->attach(scrolled_window)
> >
> > button->connect_object (clicked, ping, scrolled_window, ip, num)
> >
> > this notebook = notebook;
> > return this notebook;
> > }
> >
> > function main()
> > {
> > create new gtknotebook
> > //add stuff to notebook...
> >
> > createtable(notebook);
> > }
> >
> > main();
> > Gtk::main();
> > ?>
> >
> > Basically, no matter what I do, I can't get the scrolled window to
> > update with the information. I've tried the following:
> >
> > 1) I have tried passing in the scrolled window, and trying to get it to
> > redraw in the ping function.
> > 2) I have tried passing the whole table to the ping function, to get it
> > to redraw.
> > 3) I have tried using a GtkCList instead of a GtkText with no avail.
> > 4) I have tried using queue_draw(), queue_resize(), and hide() and show().
> > 5) I have tried using unmap().
> >
> > I know that the output is there, because if I echo it, it prints to the
> > terminal I run the program from.
> >
> > Here's the results of what I tried:
> >
> > 1) Sometimes, the program will echo the results to the terminal, and
> > the scrollbar will get smaller, like something is in the scrolled
> > window, but nothing is visible. Other times, I get the error message
> > "Gtk-CRITICAL **: file gtkscrolledwindow.c: line 899
> > (gtk_scrolled_window_add): assertion 'bin->child == NULL' failed." That
> > makes me think it's a bug.
> >
> > 2) If I pass in the whole table, the same thing happens as in number 1.
> >
> > 3) Nothing happens in the window. (The output is still echoed to the
> > terminal.)
> >
> > 4) Nothing happens in the window. (The output is still echoed to the
> > terminal.)
> >
> > 5) The scrolled window disappears, which means that the unmap() is
> > working, but trying to get another one with the results to appear hasn't
> > worked.
> >
> > I have also tried many combinations of the above. However, I can't see
> > that I'm doing anything wrong. (That, of course, should be the first
> > hint that I am. [;)] ) Basically, I want to pass in a scrolled window,
> > get some output, and redraw it, and nothing I do seems to be able to
> > make that happen.
> >
> > The full source code (as it is so far) is available at
> > http://phpgtk.bc90021.net .
> >
> > Thanks in advance!
> >
> > Tom
> >
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>