[gtkmm] Mouse position
- From: Martin Wackenhut <Martin Wackenhut it-dv-wackenhut de>
- To: gtkmm-list gnome org
- Subject: [gtkmm] Mouse position
- Date: Tue, 7 Jan 2003 14:13:10 +0100
Hi,
I know this is in the archiv but even with that I am stuck.
Just want to print the mouse position in a drawing area.
Here is what I did (using glade)
bool print2(GdkEventMotion *event)
{
int mouse_x, mouse_y;
mouse_x = event->x;
mouse_y = event->y;
std::cout <<"mouse xy: " << mouse_x << "," << mouse_y << "\n";
return true;
}
Gtk::DrawingArea* draw=0;
refXml->get_widget("drawingarea1", draw);
(*draw).set_events(Gdk::POINTER_MOTION_MASK);
if (draw)
{
draw->signal_motion_notify_event().connect(SigC::slot(*this,&print2));
}
Compiling this I get:
glade.cc:84: no matching function for call to lot (glade &, {unknown type})'
I am a bit lost because the followin for a button works:
Gtk::Button* Button = 0;
refXml->get_widget("button1", Button);
if(Button)
{
Button->signal_clicked().connect(SigC::bind<std::string>(SigC::slot(&print),"button1 clicked"));
Button->signal_enter().connect(SigC::bind<std::string>(SigC::slot(&print),"b1 enter"));
}
Even omitting *this gives stupid results.
Thanks
Martin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]