clist EXTENDED selection & keyboard
- From: toDSaH <todsah nihilist nl>
- To: gtk-app-devel-list gnome org
- Subject: clist EXTENDED selection & keyboard
- Date: 24 Feb 2002 12:41:39 +0100
Hi,
I'm currently experimenting with GTK by building a small file manager.
I've created a clist with EXTENDED selection mode. When I start the
application, the clist grabs the focus, and I can move around the files
in the list using the arrow (cursor) keys. I've set up a key_press
handler on the clist, which, amongst other functions, shows the
currently selected files. My code for getting the selection is:
void panel_showselected (panel *p) {
char *filename;
GList *cur;
cur = GTK_CLIST(p->list)->selection;
while (cur) {
gtk_clist_get_text (
GTK_CLIST(p->list),
GPOINTER_TO_INT(cur->data),
0,
&filename);
printf ("%s\n",filename);
cur = cur->next;
}
}
This works, but only for 1 selected file. If I create a selection of
multiple files with the keyboard (using shift + arrow) and I call the
panel_showselected() function, cur oddly enough is NULL. After the call
to panel_showselected() the arrow keys also stop working. When I use the
mouse to click somewhere in the list (for the first time), the arrow
keys work again, and after this, selections made with shift+arrows DO
work (as in, cur is a pointer to the GList of selected files) and keep
working.
Could somebody explain to me what I'm doing wrong or what I forgot? It
would seem this is a focus problem, but if that's the case, how come I
can use the arrow keys to move around the list?
Thanks in advance,
Ferry Boender
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]