Re: Num keypad Enter doesn't work (re-sent)



I have exactly the same problem. I've tryed gtk_widget_add_accelerator with
GDK_Return and GDK_KP_Enter but with no success.


The only solution I've found was to work around it that way (the
insert_text_handler function is a callback on the insert_text event) :
static void insert_text_handler(GtkEntry *entry, const gchar *text, gint
length, gint *position, gpointer pxData_E)
{
 GtkEditable      *editable   = GTK_EDITABLE(entry);
 gchar      *result    = NULL;


 if (text[length - 1] == 0x0D) /* That's what the numkeypad enter is
producing for invisible caractere */
 {
  if (length > 1)
  {
   result = calloc(length - 1, sizeof(gchar));
   strncpy(result, text, length - 1);
  }

  gtk_signal_handler_block_by_func
    (
     GTK_OBJECT(editable),
     GTK_SIGNAL_FUNC(insert_text_handler),
     pxData_E
    );
  gtk_editable_insert_text
    (
     editable,
     result,
     length - 1,
     position
    );
  gtk_signal_handler_unblock_by_func
    (
     GTK_OBJECT(editable),
     GTK_SIGNAL_FUNC(insert_text_handler),
     pxData_E
    );

  gtk_signal_emit_stop_by_name(GTK_OBJECT(editable), "insert_text");

  gtk_signal_emit_by_name(GTK_OBJECT(editable), "activate");

  free(result);
 }
}




Best regards,
---
Jean-Christophe Berthon



----- Original Message -----
From: "Graham Ashton" <gashton cmedltd com>
To: <gtk-list gnome org>
Sent: Wednesday, April 17, 2002 11:27 AM
Subject: Num keypad Enter doesn't work (re-sent)


> I tried sending this yesterday, but neither I nor my mate received it
> (though it did arrive in the archive). Apologies if this is your second
> copy...
>
> -----Forwarded Message-----
>
> From: Graham Ashton <gashton cmedltd com>
> To: gtk-list gnome org
> Subject: Num keypad Enter doesn't work
> Date: 16 Apr 2002 10:38:35 +0100
>
> Hi. I'm trying to work out why the Enter key on my numeric keypad prints
> a square into text entry widgets. It works just like the main enter key
> in most situations (e.g. in a gnome-terminal, while editing mail in
> evolution, etc.) but in bog standard GtkEntry widgets it just prints
> squares and doesn't behave like an enter key at all.
>
> Where should I start looking? I'm wondering if it's a font encoding
> issue, but I don't know a thing about it.
>
> Thanks.
>
> --
> Graham Ashton
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list




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