Re: CList selection and focus

From: Date: Sat, 05 Jun 2004 15:32:09 +0000
Subject: Re: CList selection and focus
References: 1  Groups: php.gtk.general 
Request: Send a blank email to php-gtk-general+get-4614@lists.php.net to get a copy of this message
Hi, Sunday, May 30, 2004, 11:34:16 AM, you wrote: AJ> Hi all, AJ> New to this list, new to PHPGTK, but otherwise pretty confortable with AJ> PHP and a handfull of other scripting languages, although I am not an AJ> expert programmer... AJ> I am running PHPGTK 1.0 on win2k sp4. AJ> Currently I'm building a database app, and I'm using the CList widget in AJ> various places, even if I do not require multiple columns. The reason AJ> being that the List widget does not seem to give any visual clues as to AJ> whether or not it has keyboard focus. AJ> I am using a single column CList with 200 or so entries in Browse AJ> selection mode. In order to speed up navigation, I wrote a handler that AJ> picks up key-press events and selects the first consecutive row where the AJ> first character of the entry text corrisponds with the pressed key. The AJ> aim is to have the list behave in a manner similar to the HTML SELECT AJ> element and most other GUI list widgets I'm familiar with. AJ> The handler uses the select_row() method, and it works. BUT: AJ> Even when the list is in Browse mode, the keyboard focus does not follow AJ> the selection (as it does when navigating the list with the up/down arrow AJ> keys). AJ> Is there some way to move the focus along with the selection? AJ> Any suggestions, pointers appreciated. AJ> TIA, AJ> -- AJ> André AJ> ============================================================ AJ> I'm out of my mind, but feel free to leave a message... AJ> -- AJ> PHP-GTK General Mailing List (http://gtk.php.net/) AJ> To unsubscribe, visit: http://www.php.net/unsub.php I have been playing with this and ended up modifying gtkclist.c to fix the problem. If you want I can send you libgtk-0.dll for you to try or if you compile your own gtk dll add the following to the end of real_select_row function in gtkclist.c if (CLIST_UNFROZEN (clist) && (gtk_clist_row_is_visible (clist, row) != GTK_VISIBILITY_NONE)) GTK_CLIST_CLASS_FW (clist)->draw_row (clist, NULL, row, clist_row); /* new bits below */ gtk_clist_draw_focus (GTK_WIDGET (clist)); gdk_gc_set_line_attributes (clist->xor_gc, 1, GDK_LINE_SOLID, 0, 0); clist->focus_row = row; gtk_clist_draw_focus (GTK_WIDGET (clist)); -- regards, Tom

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