GtkEntryCompletion using keyboard

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

GtkEntryCompletion using keyboard

Veronica A. Bendersky-2
Hi,

I have tried to use gtkentrycompletion, it works ok if I use the mouse to select an alternative, but if I want to use the keyboard only (which is something my users want to do since they're just typing info in and want to avoid the mouse as much as possible inside the entry screen), then it seems that the gtkentrycompletion keeps losing focus and I cannot move inside the list or select a suggested option just using the arrows and enter or tab. Is there a way to make gtkentrycompletion work without using the mouse to select an option?

Thanks!
Veronica
Reply | Threaded
Open this post in threaded view
|

Re: GtkEntryCompletion using keyboard

Veronica A. Bendersky-2
Hi Madeleine,

Thanks for your reply.
After looking at the code some more, I think my problem is related to having
the model fill in as users type.
The whole list of values is very long so it is in database, and as users
type, I intercept the key-released-event signal, and load the model of the
completion widget accordingly.
I think there must be something related to this that I need to do when the
arrow keys are pressed to avoid the completion widget from not behaving
correctly.

This is the relevant code (it is inside a class thus all the $this):

  $calle_actual = "";

   if (defined("GObject::TYPE_STRING")) {
       $this->model_calle = new GtkListStore(GObject::TYPE_STRING); // note
1
   } else {
       $this->model_calle = new GtkListStore(Gtk::TYPE_STRING); // note 1
   }
   $this->completion_calle = new GtkEntryCompletion();
   $this->completion_calle->set_model($this->model_calle);
   $this->completion_calle->set_text_column(0);

   $this->calle = new GtkEntry();
   $this->calle->set_text($calle_actual);
   $this->calle->set_completion($this->completion_calle_legal);
   $this->calle->connect('key-release-event',array(&$this,'update_model_calle'));
   $this->completion_calle->connect('key-release-event',array(&$this,'update_calle'));

I think I should make the update_calle function ignore all keys except
Enter, so it updates the gtkentry contents on Enter keypress and ignores
rest of keys.
Do you think that would work? Should function return false for the rest of
the keys?

Thank you!

Veronica

----- Original Message -----
From: "Madeleine D." <[hidden email]>
To: "Veronica A. Bendersky" <[hidden email]>
Sent: Tuesday, August 18, 2009 1:33 PM
Subject: Re: [PHP-GTK] GtkEntryCompletion using keyboard


>
> Veronica -
>
> Not sure if you got an answer for this one yet.
>
> We have the same issue; users wanting to avoid mouse action.  And we use
> GtkEntryCompletion on many of our screens w/o problems.
> Could you maybe post the relevant code?
>
> thanks,
> Madeleine D.
>
>
> Veronica A. Bendersky wrote:
>> Hi,
>>
>> I have tried to use gtkentrycompletion, it works ok if I use the mouse to
>> select an alternative, but if I want to use the keyboard only (which is
>> something my users want to do since they're just typing info in and want
>> to avoid the mouse as much as possible inside the entry screen), then it
>> seems that the gtkentrycompletion keeps losing focus and I cannot move
>> inside the list or select a suggested option just using the arrows and
>> enter or tab. Is there a way to make gtkentrycompletion work without
>> using the mouse to select an option?
>>
>> Thanks!
>> Veronica


--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php