Re: GtkScrolledWindow issues

From: Date: Thu, 13 Mar 2003 08:15:40 +0000
Subject: Re: GtkScrolledWindow issues
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-3094@lists.php.net to get a copy of this message
----- Original Message ----- From: "Benjamin Smith" <bens@effortlessis.com> To: <php-gtk-general@lists.php.net> Sent: Thursday, March 13, 2003 2:31 AM Subject: [PHP-GTK] GtkScrolledWindow issues > How can you make GtkScrolledWindow follow the widgets that have focus? > > I have a big list of questions and I want to take input for each, in a > scrollable window. > > What I have so far is a GtkFixed widget with the questions and the associated > input box on a GtkFixed, such as > > $questions=array('Do birds have feathers?', 'Do planes have wings?', > 'and so on...'); > $bg=GtkFixed(); you need: $bg = &new GtkFixed(); > while (list($k, $question)=each($questions)) > { > ${'item'.$k}=&New GtkLabel($question); > ${'ans'.$k}=&New GtkEntry(); > ${'ans'.$k}->Connect('changed', 'HandleAnswer'); > $bg->put(${'item'.$k}, 0, 20*$k); > $bg->put(${'ans'.$k}, 350, 20*$k); > } > > Then, I put the GtkFixed item into a scrollable window > > $scroll=&New GtkScrolledWindow(); > $scroll->Set_Usize(400, 400); > $scroll->Add_With_Viewport($bg); > > This seems to work very well, the arrow keys work as expected, except that > when you arrow down to the bottom of the screen, you can go past the viewable > area and the window doesn't scroll to follow the selected GtkEntry. > > How can I make the window "follow", or scroll down to display whatever widget > has focus via the keyboard? > > -- > PHP-GTK General Mailing List (http://gtk.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.gtk.general (#3094) next »