Re: Moveto in Clist?
| From: | Gonzalo Monzón | Date: | Tue, 21 Jun 2005 16:30:48 +0000 |
| Subject: | Re: Moveto in Clist? | ||
| References: | 1 2 3 4 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-5885@lists.php.net to get a copy of this message | ||
Benjamin Smith escribió:
Has this little tweak made it into CVS? Will it be part of a future "stable" release of PHP-GTK 4.3.x? I'd love to have the .dll file - how stable is it compared to the .dll file in the "stable" release? -Ben On Wednesday 15 June 2005 18:09, Tom Rogers wrote:aHi, Thursday, June 16, 2005, 8:29:56 AM, you wrote: MD> Ben - MD> Sorry, I haven't solved this one yet. There was a discussion on the Gtk MD> list on clist row focus, and the response was - no can do. But I'vegottenMD> that before over there and gone on to find a solution, because I had to. MD> So that's not a definite in my mind. MD> You ought to be able to mimick the kind of behavior you get it byselectingMD> and unselecting a row with your mouse, but I tried select_row and then MD> unselect_row, and didn't get what I wanted. MD> It's on the list for another day. MD> Madeleine D. MD> At 02:27 PM 6/15/05 -0700, Benjamin Smith wrote:focus,Madeleine, thanks! I've left a note on the doc site with functional sample code, so that next time I need to do this, I can. One more question: Is there a "Set_Focus_Row()" capability anywhere? I can access the focus_row property to find out what row currently has thebut I can't seem to set the focus. Any ideas? The methods available with the word "focus" are focus set_focus_child set_focus_vadjustment set_focus_hadjustment draw_focus grab_focus None of which seem to do what I want. Am I just SOL for this? -Ben On Wednesday 15 June 2005 13:46, Madeleine D. wrote:Ben - I ran a quick test on your code and got it to work. I just had to make
itcouple key changes: 1. I removed the 'add_with_viewport'. CList is a scrollable object, so
along; Ionly 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
asjust 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
canwell; 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
MD> withmakeI tried what you mentioned below as follows, and now the clist ends upthis work, life in one area gets much better for me...
aroundstillfocus, and the script output indicates that it should be moved, but itisn't moving. The clist has focus, as indicated by a black border
torow0$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:that isn't there when I don't grab_focus first.Ben - I just go this working a couple days ago, and am working on an update
suregrab_focusthe Docs page. Meantime, there are a couple points. First, I found I needed toon the clist before a move would occur at all. Second, I had to make
the row existed and wasn't already visible, as in: if ($clistObj->row_is_visible($lastRow) != GTK_VISIBILITY_FULL)
{
Also,$clistObj->moveto($lastRow,0,1.0,0.0);} If the row, column don't exist, the moveto method goes nowhere.
MD> selectedthismoves the scroll bar, not the selection, so if you need the row
MD> useaswell, that's a separate step. There's a third, which may or may not apply to you. Once I wanted to
loaded,abutton to move the scroll bar after the window had been painted and
thatthere was a whole nother issue with that. Let me know if you need
MD> executablesright 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:scrolledI'm trying to make clist "jump" to a specific row/col that has to beto to get to. I'm running the latest PHP-GTK for PHP 4.x, with PHP 4.3.11
NoonMSWindows. Here's a demonstration of what I'm trying - what am I doing wrong?
The problem is at the gtk level, you need to modify gtkclist.c like this: if (CLIST_UNFROZEN (clist) && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE))-- "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-- "The best way to predict the future is to invent it." - XEROX PARC slogan, circa 1978errors-- PHP-GTK General Mailing List (http://gtk.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php// 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();seem to be reported anywhere that I can find.// 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
clist_row);GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row,
/* new bits below */
gtk_clist_draw_focus (GTK_WIDGET (clist));
clist->focus_row = row;
If you can't rebuild gtk I can let you have the dll for windows.
-- regards,
Tom
Hi Benjamin,
Maybe you could move from the clist to a ctree.
I noticed several issues like this and using ctrees was the only solution.
Regards.