Re: Problems with Rulers in gtk--




>> That connect should connect the motion_notify_event of the drawing_area to
>> to ruler, but I can't find a correct syntax.
>> 
>> I tried
>> 
>>connect(drw_area.motion_notify_event,&hruler,Gtk_HRuler::motion_notify_event);
>
>
>connect(drw_area.motion_notify_event,hruler->motion_notify_event);
>
>Those are both signals, so need to use connect() syntax for function objects.
>
>(It uses the following signature:
>template<class rettype, class M,class P1>
>Connection connect(Signal1_r<rettype,P1> &signal, M& functionobject);
>)
>
Now as I look at the readme_signal.html in your website I see that, too,
but I' just tried it and gcc doesn't like it.
Well, in my casse hruler is a Gtk_HRuler, not a pointer to one,
so I have

connect(drw_area.motion_notify_event,hruler.motion_notify_event);

but gcc says:

/usr/local/include/gtk--sig.h: In function `class Connection connect(class
Signal_proxy1<int,Gtk_Widget,_GdkEventMotion *> &, class
Signal_proxy1<int,Gtk_Widget,_GdkEventMotion *> &)':
/usr/local/include/gtk--sig.h:1341: no matching function for call to
`Concretegtkslot1<int,int (*)(_GdkEventMotion *),_GdkEventMotion
*>::Concretegtkslot1<int,int (*)(_GdkEventMotion *),_GdkEventMotion *>
(Signal_proxy1<int,Gtk_Widget,_GdkEventMotion *>)'
/usr/local/include/gtk--sig.h:1099: candidates are: Concretegtkslot1<int,int
(*)(_GdkEventMotion *),_GdkEventMotion *>::Concretegtkslot1(const
Concretegtkslot1<int,int (*)(_GdkEventMotion *),_GdkEventMotion *> &)
/usr/local/include/gtk--sig.h:1099:                 Concretegtkslot1<int,int
(*)(_GdkEventMotion *),_GdkEventMotion *>::Concretegtkslot1(int
(*)(_GdkEventMotion *))
make: *** [colorbutton.o] Error 1

I don't know what that means, maybe one of my stupid errors,
something is missing in gtk--...

Actually, I've found another way to connect the c signals of the
rulers, but much more awful through typecasts and c-functions:

connect(drw_area.motion_notify_event,this,&ruler_motion_notify);

  //which connects to the member function:

gint ruler_motion_notify(GdkEventMotion *event)
  { 
    typedef gint (*MotionEventFunc)  (GtkWidget *,GdkEventMotion *);  
    GtkWidget *widget = GTK_WIDGET(hruler.gtkobject);  
    MotionEventFunc func =( MotionEventFunc)   (GTK_WIDGET_CLASS(GTK_OBJECT
(widget)->klass)->motion_notify_event);
 

    func((GtkWidget *)widget,event);
    widget = GTK_WIDGET(vruler.gtkobject);
    func =( MotionEventFunc)   (GTK_WIDGET_CLASS(GTK_OBJECT
(widget)->klass)->motion_notify_event);
    func((GtkWidget *)widget,event);


  }


that is similar to the way it is done in testgtk, but I would prefer your 
way, would be much shorter...

Bye,
Oliver


>-- 
>-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --
>
>-- 
>To unsubscribe: mail -s unsubscribe gtk-list-request@redhat.com < /dev/null
>

----------------------------------
E-Mail: Oliver Freyd <freyd@uni-muenster.de>
Date: 18-Apr-98
Time: 14:14:49

This message was sent by XFMail
----------------------------------



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