Re: [gtk-list] RE: changing entry shortcut hooks



On Wed, 4 Mar 1998, Tony Gale wrote:

> 
> On 04-Mar-98 Helge Hess wrote:
> > in gtkentry.c is a static array of functions which perform some
> > operation on the entry widget when the control or alternate key is
> > pressed.
> 
> I have similiar question. I have an entry in which I would like to
> intercept the arrow keys to do command recall. At the moment the
> arrow keys change the keyboard focus.  I guess this is at a higher
> level than Helge's question.
> 
> I would also like to intercept things like Ctrl-K in an entry widget
> (which is the same as Helge's question) and not have the entry widget
> use it's default handling.


though i wrote this out of my head, i'm pretty surte it'll work ;)

gint
my_handler (GtkEntry *entry,
            GdkEventKey *event,
            gpointer user_data)
{
  switch (event->keyval)
  {
    gint pos;
    
  case  GDK_F10:
    pos = GTK_EDITABLE(entry)->current_pos;
    gtk_editable_insert_text (GTK_EDITABLE (entry), "my macro", 8, &pos);
    return TRUE;
  
  default:
    return FALSE;
  }
}


and upon entry creation you do:

gtk_signal_connect (GTK_OBJECT (entry),
		    "key_press_event",
		    GTK_SIGNAL_FUNC (my_handler),
		    NULL);


		    
> 
> Thanks
> 
> Tony
> 

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]