Re: signal_enter_notify_event() does nothing



Bartek Kostrzewa wrote:


I think you could add mouse related events to the button, like adding
in its ctor (or just after it was created):

add_events (Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK );


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

How would I put that in my code? just like so?:
add_events (Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK );


toolUndo.add_events( ... ); (or "->" if toolUndo is a pointer) ... is
toolUndo a pointer? because that might be the problem.. altough the
compiler should shout if it is not a pointer (and you are using -> ) you
might be compiling on the microsoft compiler and that's known to be
pretty crappy concerning type safety

so toolUndo is a Gtk::Button ?


toolUndo->signal_enter_notify_event().connect(sigc::mem_fun(*this,&MainWindow::nothingExec));
I use gcc and toolUndo->add_events (Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK ); doesn't change anything either.
Let me show some sourcecode:

class MainWindow:public Gtk::Window {
...
  protected:
     Gtk::ToolButton *toolUndo;
     virtual bool nothingExec(GdkEventCrossing* event);
     virtual bool nothingClick(GdkEventButton* event);
...
};

MainWindow::MainWindow(){
...
  toolUndo=Gtk::manage(new Gtk::ToolButton(iconToolUndo));
toolUndo->add_events (Gdk::POINTER_MOTION_MASK | Gdk::ENTER_NOTIFY_MASK ); toolUndo->signal_enter_notify_event().connect(sigc::mem_fun(*this,&MainWindow::nothingExec)); toolUndo->signal_button_press_event().connect(sigc::mem_fun(*this,&MainWindow::nothingClick)); toolUndo->signal_clicked().connect(sigc::mem_fun(*this, &MainWindow::nothingToDo));
...
}

void MainWindow::nothingToDo(){
  std::cout << "nothing to do" << std::endl;
}

bool MainWindow::nothingExec(GdkEventCrossing* event){
  std::cout << "nothing to exec" << std::endl;
  return false;
}

bool MainWindow::nothingClick(GdkEventButton* event){
  std::cout << "nothing to click" << std::endl;
  return false;
}



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