Re: Controlling a widget from an other



On Sun, 2006-11-12 at 17:00 +0000, Kalap kabat wrote:
> David Nečas (Yeti <yeti <at> physics.muni.cz> writes:
> 
> > 
> > On Sun, Nov 12, 2006 at 05:06:25PM +0100, kalap kabat wrote:
> > > 
> > > - Catch the keypress in the text entry and invoke the 
> > > appropriate functions of the treeview for scrolling. This does 
> > > not seem viable, since the scrolling functions are not exposed 
> > > for the treeview.
> > 
> > The scrolled window you put the treeview to has signal
> > "scroll-child" to scroll the contained widget.  The signal
> > is a bit underdocumented, but the GtkScrollType argument
> > should be clear and the boolean argument is TRUE for
> > horizontal scrolling, FALSE for vertical.
> 
> I tried this:
> 
>      scrolled.emit('scroll-child', gtk.SCROLL_PAGE_FORWARD, False)
> 
> and it's scrolling the treeview, but it doesn't move the selection like when 
> the treeview has the focus and I press PgDown there. 
> 
> I have the feeling it would be much simpler to send a PgDown keypress to the 
> treeview somehow. I made a Winforms GUI recently and there it was trivial to 
> send keypresses to an other widget using SendKeys. Surely, after all these 
> years of development GTK has to have some method to do that.

you noted that it doesn't move "like when the treeview has the focus".
so for this to work the way you want it to, your SendKeys method would
have to move the focus away from the entry. thus, i submit that the
problem is not the absence of a SendKeys method (it can certainly be
done, btw), but the fact that the treeview's behaviour when scrolling
depends on whether it has keyboard focus or not. i've written "SendKeys"
in the past, but i always end up finding that there is no actual need
for it or that it doesn't accomplish what i am actually trying to
accomplish.

--p





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]