Re: Moveto in Clist?

From: Date: Wed, 15 Jun 2005 20:46:40 +0000
Subject: Re: Moveto in Clist?
References: 1 2  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-5879@lists.php.net to get a copy of this message
Ben - I ran a quick test on your code and got it to work. I just had to make a couple key changes: 1. I removed the 'add_with_viewport'. CList is a scrollable object, so it only needs 'add'. And that step was definitely a problem; when I put it back, moveto failed. This has probably been the issue for you all along; I just didn't catch it first time out. 2. I changed $lastRow to 999, and the moveto parm to 999, just to make sure it was actually making it to the bottom of the list. 99 works just as well; anything outside the visible area. So my code looks like: $s['clist']=&New GtkClist(1, array('snork')); for($i=0; $i<1000; $i++) $s['clist']->Append(array($i)); $scrolled=&New GtkScrolledWindow(); //$scrolled->Add_With_ViewPort($s['clist']); $scrolled->add($s['clist']); $win=&New GtkWindow(); $win->Add($scrolled); $win->Set_Usize(500, 500); $win->Show_All(); $s['clist']->Grab_Focus(); if ($s['clist']->row_is_visible(999) != GTK_VISIBILITY_FULL) { echo "We're moving it!"; $s['clist']->moveto(999,0,1.0,0.0); } Hope that helps. Madeleine D. At 01:16 PM 6/15/05 -0700, you wrote: >Madeleine, > >I'd //LOVE// whatever documentation and notes you have on this! If I can make >this work, life in one area gets much better for me... > >I tried what you mentioned below as follows, and now the clist ends up with >focus, and the script output indicates that it should be moved, but it still >isn't moving. The clist has focus, as indicated by a black border around row0 >that isn't there when I don't grab_focus first. > >$s['clist']=&New GtkClist(1, array('snork')); > >for($i=0; $i<1000; $i++) > $s['clist']->Append(array($i)); >$scrolled=&New GtkScrolledWindow(); >$scrolled->Add_With_ViewPort($s['clist']); > >$win=&New GtkWindow(); >$win->Add($scrolled); >$win->Set_Usize(500, 500); >$win->Show_All(); > >if ($s['clist']->row_is_visible($lastRow) != GTK_VISIBILITY_FULL) > { > echo "We're moving it!"; > $s['clist']->Grab_Focus(); > $s['clist']->moveto(99,0,1.0,0.0); > } > >On Wednesday 15 June 2005 11:21, Madeleine D. wrote: >> Ben - >> >> I just go this working a couple days ago, and am working on an update to >> the Docs page. >> >> Meantime, there are a couple points. First, I found I needed to grab_focus >> on the clist before a move would occur at all. Second, I had to make sure >> the row existed and wasn't already visible, as in: >> >> if ($clistObj->row_is_visible($lastRow) != GTK_VISIBILITY_FULL) { >> $clistObj->moveto($lastRow,0,1.0,0.0); >> } >> >> If the row, column don't exist, the moveto method goes nowhere. Also, this >> moves the scroll bar, not the selection, so if you need the row selected as >> well, that's a separate step. >> >> There's a third, which may or may not apply to you. Once I wanted to use a >> button to move the scroll bar after the window had been painted and loaded, >> there was a whole nother issue with that. Let me know if you need that >> right away, otherwise, it will be on Docs page, once I can get to it. >> >> Hope that helps. >> >> Madeleine D. >> >> >> >> At 10:39 AM 6/15/05 -0700, you wrote: >> >I'm trying to make clist "jump" to a specific row/col that has to be >> scrolled >> >to to get to. >> > >> >I'm running the latest PHP-GTK for PHP 4.x, with PHP 4.3.11 executables on >> MS >> >Windows. >> > >> >Here's a demonstration of what I'm trying - what am I doing wrong? No >errors >> >seem to be reported anywhere that I can find. >> > >> > >> >// CREATE THE CLIST WIDGET >> >$s['clist']=&New GtkClist(1, array('snork')); >> >// POPULATE THE WIDGET >> >for($i=0; $i<1000; $i++) >> > $s['clist']->Append(array($i)); >> >// PUT IT IN A SCROLLED WINDOW... >> >$scrolled=&New GtkScrolledWindow(); >> >$scrolled->Add_With_ViewPort($s['clist']); >> >// PUT THE WINDOW IN A SCREEN. >> >$win=&New GtkWindow(); >> >$win->Add($scrolled); >> >$win->Set_Usize(500, 500); >> >$win->Show_All(); >> >// EVERYTHING LOOKS FINE TO HERE... >> > >> >// NOW, TO MAKE IT "JUMP"... BUT IT DOESN'T SEEM TO DO ANYTHING >> >$s['clist']->MoveTo(99, -1, 0.5, 0.5); >> > >> >-Ben >> >-- >> >"The best way to predict the future is to invent it." >> >- XEROX PARC slogan, circa 1978 >> > >> >-- >> >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 >> >> > >-- >"The best way to predict the future is to invent it." >- XEROX PARC slogan, circa 1978 >

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