Re: Gtk::Image and mouse click



Hi

thankx for help.
With the GdkEventButton compilation is OK.
And how can I handled coordinates from event.

regards
Paul Davis wrote:
Is it just me, or should that function prototype be:

MainWindow::on_image2_button_press( GdkEventButton* event ) ; ?

And whats on line 201 in MainWindow.cpp?

Paul Davis

On 12/1/06, Petr Hracek <petr hracek siemens com> wrote:

 I change function on_image2_button_press to the return value bool
 and allways I return true now,
 but the result is:

 In header:
        virtual bool on_image2_button_press(GdkEvent * event);

 In CPP code:
 bool MainWindow::on_image2_button_press(GdkEvent * event)
 {
         Log("Procedure for button press");
         int x=0;
         int y=0;
         image2.get_pointer(x,y);
         sprintf(message,"X coor: %d, Y coor: %d",x,y);
         Log(message);
         imageOperation->getObject(x,y);

         Log("End procedure for button press");
         return true;
 }

 and result is:
 /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:
In member function 'typename
sigc::adaptor_functor<T_functor>::deduce_result_type<T_arg1,
void, void, void, void, void, void>::type
sigc::adaptor_functor<T_functor>::operator()(T_arg1) const
[with T_arg1 = GdkEventButton* const&, T_functor =
sigc::bound_mem_functor1<bool, MainWindow, GdkEvent*>]':
 /usr/include/sigc++-2.0/sigc++/functors/slot.h:137:   instantiated from
'static T_return sigc::internal::slot_call1<T_functor,
T_return, T_arg1>::call_it(sigc::internal::slot_rep*,
typename sigc::type_trait<T_arg3>::take) [with T_functor =
sigc::bound_mem_functor1<bool, MainWindow, GdkEvent*>, T_return = bool,
T_arg1 = GdkEventButton*]'
 /usr/include/sigc++-2.0/sigc++/functors/slot.h:144:   instantiated from
'static void* (* sigc::internal::slot_call1<T_functor,
T_return, T_arg1>::address())(void*) [with T_functor =
sigc::bound_mem_functor1<bool, MainWindow, GdkEvent*>, T_return = bool,
T_arg1 = GdkEventButton*]'
 /usr/include/sigc++-2.0/sigc++/functors/slot.h:529:   instantiated from
'sigc::slot1<T_return, T_arg1>::slot1(const T_functor&) [with T_functor =
sigc::bound_mem_functor1<bool, MainWindow, GdkEvent*>, T_return = bool,
T_arg1 = GdkEventButton*]'
/usr/include/sigc++-2.0/sigc++/functors/slot.h:1157: instantiated from 'sigc::slot<T_return, T_arg1, sigc::nil, sigc::nil, sigc::nil, sigc::nil,
sigc::nil, sigc::nil>::slot(const T_functor&) [with T_functor =
sigc::bound_mem_functor1<bool, MainWindow, GdkEvent*>, T_return = bool,
T_arg1 = GdkEventButton*]'
 MainWindow.cpp:201:   instantiated from here
/usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:84:
error: no match for call to
'(sigc::bound_mem_functor1<bool, MainWindow, GdkEvent*>)
(GdkEventButton* const&)'
 /usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:1850:
note: candidates are: T_return
sigc::bound_mem_functor1<T_return, T_obj,
T_arg1>::operator()(typename sigc::type_trait<T_arg3>::take) const [with
T_return = bool, T_obj = MainWindow, T_arg1 = GdkEvent*]
 make: *** [MainWindow.o] Error 1

 regards
 Petr

 Murray Cumming wrote:
 On Fri, 2006-12-01 at 14:53 +0100, Petr Hracek wrote:


 Hi all,

I know that I wrote following problem before a 2 months but
unfortunatelly
I've upgraded my PC from FC5 to FC6 and now it does not work again.

 [snip]

I don't believe this code compiled on FC5 either.



 and function look like this:
void MainWindow::on_image2_button_press(GdkEvent * event)
{

 [snip]

That signal handler should return a bool. Template errors are indeed
often difficult to understand.




 --
Petr Hráček, PSE ECT PSS27
ANFDATA spol. s r.o.
a SIEMENS Company
MediaHall, Bidlaky 20, 639 00 Brno, Czech Republic
Tel. +420 533 337 267
Fax. +420 533 337 252
mailto: petr hracek siemens com


_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
http://mail.gnome.org/mailman/listinfo/gtkmm-list





--
Petr Hráček, PSE ECT PSS27
ANFDATA spol. s r.o.
a SIEMENS Company
MediaHall, Bidlaky 20, 639 00 Brno, Czech Republic
Tel. +420 533 337 267
Fax. +420 533 337 252
mailto: petr hracek siemens com




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