Re: GtkScrolledWindow issues
| From: | Benjamin Smith | Date: | Thu, 20 Mar 2003 01:00:01 +0000 |
| Subject: | Re: GtkScrolledWindow issues | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-3121@lists.php.net to get a copy of this message | ||
> gtkfixed isn't a scrolling-aware object.
Awyk! (I'm still a newbie!)
So today I tried using GtkLayout(). I immediately ran into issues with
display, which I found a workaround for in the mailing list. (and posted in
the manual =) I'm developing on Win2K.
However, I *still* have the same problem - when I use the Tab key to scroll
through GtkEntry items on the GtkLayout item within the GtkScrolledWindow,
the scroll bars don't follow the focus of the cursor.
Thus, I end up typing in a field that's off the screen!
In other words, we start with something like this: (I hope this communicates
the idea)
-------------------------------------------
Question1 [ GtkEntry ]
Question2 [ GtkEntry ]
Question3 [ GtkEntry ]
Question4 [ GtkEntry ]
Question5 [ GtkEntry ]
Question6 [ GtkEntry ]
Question7 [ GtkEntry ]
-------------------------------------------
And I want to put it into a scrollable box 3 lines tall:
+------------------------------------------------+
Question1 [ GtkEntry ] ^
Question2 [ GtkEntry ] ||
Question3 [ GtkEntry ] V
+------------------------------------------------+
I seem to get similar results using GtkFixed or the "scrolling aware"
GtkLayout, when I use the tab key to go thru the questions, I can tab to
Question4 without ever seeing it!
Is there an answer for this, such as something like
"Get the X/Y co-ordinates for Question4, then tell the GtkScrolledWindow to
scroll down to it", represented with pseudocode:
<?
$question4->Connect('focus-in-event', 'scrollto');
Function ScrollTo($question)
{
$x=$question->Get_X_Position();
$y=$question->Get_Y_Position();
global $scrolledwindow;
$scrolledwindow->Scroll_to($x, $y);
}
?>
Is there anything that performs like this?
-Ben
On Friday 14 March 2003 05:31 am, Steph wrote:
> http://127.0.0.1/manual/en/gtk.gtkscrolledwindow.php
> (again)
>
> gtkfixed isn't a scrolling-aware object.
>
> ----- Original Message -----
> From: "Benjamin Smith" <bens@effortlessis.com>
> To: <php-gtk-general@lists.php.net>
> Sent: Friday, March 14, 2003 4:09 AM
> Subject: Re: [PHP-GTK] GtkScrolledWindow issues
>
> > > you need:
> > > $bg = &new GtkFixed();
> >
> > That's a typo for this message. The actual code size is quite large,
>
> so to
>
> > avoid confusion, I summarized it below.
> >
> > How do I make the GtkScrolledWindow scroll and follow whatever widget
>
> that has
>
> > focus gotten from the arrow keys?
> >
> > -Ben
> >
> > On Thursday 13 March 2003 12:15 am, epplestun wrote:
> > > ----- 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
> >
> > --
> > PHP-GTK General Mailing List (http://gtk.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php