[Glade-users] combo box question
- From: ashats at hotmail.com (Arthur Shats)
- Subject: [Glade-users] combo box question
- Date: Wed, 29 Sep 2010 22:11:17 +0000
Thank you, Virtualex.
I'll try to implement your suggestions, they do seem complicated, so I definitely ask more questions. And I
will look into the book you advised as well.
Arthur.
Date: Wed, 29 Sep 2010 08:56:10 -0700
Subject: Re: [Glade-users] combo box question
From: virtualex at linuxoid.net
To: ashats at hotmail.com
CC: glade-users at lists.ximian.com
I have a combobox created in Glade. In my Python code, I populate the
combobox list with items. When I tab or click into the box, I want the
item list to dropdown automatically, without clicking on the arrow. Also,
when user starts typing into the box, I would like the focus jump to the
item that closely matches what user typed... or something like that... a
standard combo box funtionality. How would I accomplish this?
You may try to emit "popup" signal which by default gets emitted on
Alt+Down, but you should keep in mind that the menu gets keyboard focus,
so the user won't be able to type anything into the entry while it's
shown. In other words there's no way to accomplish what you want using
this popup menu (although it might be a sort of answer to your next
question).
The right way to do it would be creating GtkEntryCompletion and attaching
it to the entry. It would show dropdown menu with suggestions when the
user starts typing. That menu has nothing to do with combobox menu, but
you can reuse one treemodel for both.
Another way I am looking is to prevent the user from typing anything into
the combobox and let him only pick from the dropdown down list. How do I
prevent the user from typing into the combobox?
The straightforward way is to use proper widget intended for it, namely
plain combobox, not comboboxentry. Or if you insist on status quo, filter
"key-press-event". Yet another option could be getting actual entry widget
from inside of combobox with gtk_bin_get_child() and making it
insensitive.
Looking back at the amount of questions you have, may I suggest
http://www.gtkbook.com/ as a good source of answers to many of them. It
doesn't target Python, and it might be slightly dated by now, but it still
good investment which provides perfect introduction into the matter you're
trying to conquer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/glade-users/attachments/20100929/61a052ec/attachment-0001.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]