Re: Simple Gtk app.
- From: Jose Eusebio Roza Pando <jeroza alu uah es>
- To: Mark Hannah <mhannah_mail yahoo co uk>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: Simple Gtk app.
- Date: Wed, 25 Oct 2000 16:56:41 +0200
To interpret the keystrokes you can use the code shown below.
I do not know the way to move the pixmap in gtk, but i know
that is possible with gtkextra lib. You must create a canvas
and you must insert inside a child (a pixmap for example) and
move it easily.
Eusebio
The code was generated by Carlos Pereira in other mail:
These examples should answer your question.
Carlos
------------monitor events----------------
gtk_widget_set[add]_events (GTK_WIDGET (window), GDK_EXPOSURE_MASK |
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK |
GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
--------connect-------------
gtk_signal_connect(GTK_OBJECT (window), "key_press_event",
GTK_SIGNAL_FUNC(app_gtk_handle_key_press), data);
--------callback---------------
#include <gdk/gdkkeysyms.h>
gint app_gtk_handle_key_press (GtkWidget *widget, GdkEventKey *event,
gpointer data)
{
switch (event->keyval)
{
case GDK_Escape:
case GDK_F2:
case GDK_F3:
case GDK_Page_Down:
}
/* prevent the default handler from being run */
gtk_signal_emit_stop_by_name (GTK_OBJECT(widget),"key_press_event");
return TRUE;
}
Mark Hannah escribió:
Hi,
I'm having problems writing a simple Gtk app.
What I want to do is open a window and place a pixmap
image in the window. I would then like to use the
keyboard arrow keys to move the image around the
window.
I can get as far as displaying thr pixmap in the
window, but I do not know how to capture and interpret
the keystrokes or move the pixmap position.
Can anyone help?
Many thanks,
Mark.
____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie
_______________________________________________
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]