gtk_connect_signal_object HELP PLEASE !



I'm confused about this function.
I says :

This function is for registering a callback that will call another
object's callback. That is, instead of passing the object which is
responsible for the event as the first parameter of the callback, 
it is switched with the user data (so the object which emits the
signal will be the last parameter, which is where the user data 
usually is).



I have a draw area and a status bar and I want the xy coords to show in
the status bar when the cursor is over the draw area.

I can connect the motion event to the draw area and get it to print to the
screen.

I've tried gtk_connect_signal_object to connect the status bar to connect
with the draw area but get nothing.

If I first connect the motion to the draw widget and in the callback I'm
assuming that it is the status bar I get many errors displayed to the
screen about typecasting. and I get nothing on the status bar.M 0A


Here's where i connect to the draw area

  gtk_signal_connect(GTK_OBJECT(drawing_area)
                    ,"motion_notify_event"
                    ,(GtkSignalFunc) motion_notify_event
                    ,NULL);

Here's where I connect the statusbar with the motion
event of the drawing_area.

  gtk_signal_connect_object(GTK_OBJECT (status_bar)
                           ,"motion_notify_event"
                           ,(GtkSignalFunc) motion_notify_event
                           ,GTK_OBJECT (drawing_area));
Here's my motion callback


static gint motion_notify_event( GtkWidget *widget
                                 ,GdkEventMotion *event 
                                )
{
  int             x, y;
  GdkModifierType state;
  gchar           buffer[64];
  static gint     message_id = INT_MIN;A

  if (event->is_hint)
    gdk_window_get_pointer (event->window, &x, &y, &state);
  else
    {
      x = event->x;
      y = event->y;
      state = event->state;
    }
  sprintf(buffer,"XY : %d,%d",x,y);
  g_print("buffer = %s\n",buffer);

  if (message_id NE INT_MIN) 
    gtk_statusbar_remove(GTK_STATUSBAR(widget)
                        ,context_id
                        ,message_id);
   message_id = gtk_statusbar_push(GTK_STATUSBAR(widget)
                                  ,context_id
                                  ,buffer);
  return TRUE;
}


=========+=========+=========+=========+=========+=========+=========+
   ___  _ ____       ___       __  __          
  / _ )(_) / /_ __  / _ \___ _/ /_/ /____  ___ 
 / _  / / / / // / / ___/ _ `/ __/ __/ _ \/ _ \
/____/_/_/_/\_, / /_/   \_,_/\__/\__/\___/_//_/
           /___/                               
Texas Instruments ASIC Circuit Design Methology Group
Dallas, Texas
214-480-4455
bpatton dal asp ti com
=========+=========+=========+=========+=========+=========+=========+





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