Re: gtk_scrolled_window_add_with_viewport
| From: | Steph | Date: | Fri, 05 Apr 2002 17:43:15 +0000 |
| Subject: | Re: gtk_scrolled_window_add_with_viewport | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1743@lists.php.net to get a copy of this message | ||
Yeah, you're adding the box at every run. Take it out of the while() loop.
----- Original Message -----
From: "Michael Dransfield" <mike@blueroot.net>
To: "PHP-GTK gen" <php-gtk-general@lists.php.net>
Sent: Friday, April 05, 2002 7:05 PM
Subject: [PHP-GTK] gtk_scrolled_window_add_with_viewport
> I am trying to populate a scrolled window with a vbox which has a
> checkbox for each row of a database result
>
> each time something is added i get this error
>
> Gtk-CRITICAL **: file gtkscrolledwindow.c: line 951
> (gtk_scrolled_window_add_with_viewport): assertion `child->parent ==
> NULL' failed.
>
> here is the function which generates the error
>
> global $gx;
> global $must_array;
> global $opt_array;
> $must_frame =&
> $gx->get_widget("cand_search_skills_must_scrolledwindow");
> $opt_frame =& $gx->get_widget("cand_search_skills_opt_scrolledwindow");
>
> $sql = "SELECT * from mytable";
> $res = mysql_query($sql);
>
> $must_vbox =& new GtkVBox();
> while ($row = mysql_fetch_row($res)){
> $must_cb =& new GtkCheckButton($row[1]);
> $must_cb->set_data("id", $row[0]);
> $must_cb->set_data("level", "must");
> $must_cb->get_data("level");
> $must_cb->set_active(false);
> $must_cb->connect("clicked", "cand_search_check_clicked");
> $must_vbox->pack_start($must_cb);
> $must_cb->show();
> $must_frame->add_with_viewport($must_vbox);
> }
> $must_vbox->show();
>
> I had problems accessing the vbox directly (i wanted to loop through the
> children to see the status of each checkbox) i think it is because i am
> using glade. The function get_widget() doesnt seem to return the entire
> object with its children, if the children are not present in the glade
> file. I can understand why if get_widget relies on the xml file to read
> the widget.
>
> The gtk-critical error does not crash the program (in linux, i cant test
> my app in windows because of another libglade win32 bug), just reports
> this error
>
>
>
>
> --
> PHP-GTK General Mailing List (http://gtk.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>