Re: gtkEntry, a virtual keyboard and overwriting problems
- From: Matt Flax <flatmax mimosaacoustics com>
- To: gtk-app-devel-list gnome org
- Subject: Re: gtkEntry, a virtual keyboard and overwriting problems
- Date: Fri, 13 Jan 2012 14:18:59 +1100
For those who are interested, here is the state of the event :
new_event.key.type = GDK_KEY_PRESS;
new_event.key.send_event = TRUE;
new_event.key.time = GDK_CURRENT_TIME;
new_event.key.state = 0; //GDK_KEY_PRESS_MASK;
new_event.key.length = 0;
new_event.key.string = 0;
new_event.key.hardware_keycode = 0;
new_event.key.group = 0;
On 13/01/12 10:55, Matt Flax wrote:
Hi there,
I wanted to implement a virtual keyboard using individual letter
buttons and have the string constructed displayed in the gtkEntry widget.
entry=gtk_entry_new(); // create the entry widget
GdkEvent new_event; // the gdkevent to put
I used the following approach when a button was clicked :
gtk_widget_grab_focus(entry);
new_event.key.window = gtk_widget_get_parent_window(entry);
new_event.key.keyval = c[0]; // take only the first letter
gdk_event_put(&new_event);
I found that every time I clicked a letter button, such as 'a', the
letter 'a' would be displayed in the entry widget - great ! but ....
If I try to add a second letter, such as 'b', the letter 'a' would be
overwritten by 'b'. Not so good ! I need to construct strings in the
GtkEntry widget ...
can anyone see what I am doing wrong ?
When I use the same approach with the GtkTextView widget it works OK :
entry=gtk_text_view_new (); // create the text view widget
The following works correctly - I can create strings:
gtk_widget_grab_focus(entry);
new_event.key.window = gtk_widget_get_parent_window(entry);
new_event.key.keyval = c[0]; // take only the first letter
gdk_event_put(&new_event);
The problem with this approach is that it is overly complex, I only
want the user to input a single line of text and it is harder to
extract the string from the GtkTextView widget ...
any pointers ?
thanks
Matt
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]