Re: Actions to other place
| From: | Rich Payne | Date: | Wed, 03 Jul 2002 12:50:48 +0000 |
| Subject: | Re: Actions to other place | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2187@lists.php.net to get a copy of this message | ||
On 2 Jul 2002, Pablo Fischer wrote:
> Hi..
>
> :(.. I dont know how to fix it.. tell me If Im right:
>
> function c_button_2() {
> $button_2 = &new GtkButton("Button 2");
> return $button_2;
> }
>
> (create the window and a Vbox).
>
> $button = &new GtkButton("Action Button");
> $button->connect('clicked','c_button_2',$frame);
> $vbox->pack_start($button);
>
> $frame = &new GtkFrame("Frame");
> $vbox->pack_start($frame);
>
> $window->show_all();
>
> And nothing happens. The Button that its suppoused to be created..
> doesnt appear in the frame.
What do you expect to happen? When the user clicks the first button you
create a second button but you don't do anything with it (other then
return it).
I think you want something like:
function c_button_2 ($frame, $button) {
$button_2 = &new GtkButton("Button 2");
$frame->remove($button);
$frame->add($button_2);
}
which would be called from:
$button->connect('clicked','c_button_2',$frame,$button);
Note: that's untesed code...
--rdp
> Paul Fischer
>
>
> > a gtkframe is derived from gtkbin
> >
> > it will only take one child
> >
> > you need to remove() that child before you can add() another child
> >
> > please turn your error reporting to E_ALL
> >
> > ----- Original Message -----
> > From: "Pablo Fischer" <exilion@yifan.net>
> > To: <php-gtk-general@lists.php.net>
> > Sent: Tuesday, July 02, 2002 9:36 PM
> > Subject: [PHP-GTK] Actions to other place
> >
> >
> > > Hi..
> > >
> > > Now that I have the layout of my application I dont understand (and
> > dont
> > > know) how to do this:
> > >
> > > I want that when I click a button it shows me other Widgets.. but JUST
> > > in a Frame.
> > >
> > > For example.. I have three buttons: Sodas & Food.
> > >
> > > That when I click "Sodas" button.. more buttons will appear in a Frame
> > > (Cocacola button, Pepsi button.. etc).
> > >
> > > How can I do this?.
> > >
> > > Thanks,
> > > Paul Fischer.
> > >
> > >
> > > --
> > > PHP-GTK General Mailing List (http://gtk.php.net/)
> > > To unsubscribe, visit: http://www.php.net/unsub.php
> > >
> >
> >
>
>
>
>
--
Rich Payne
http://talisman.mv.com