subscribe event to DragDropSlot
Posted: Wed Aug 01, 2007 20:03
I have a problem subscribing action to an event. I want to subscribe a method from a different class, which the subscriber function is in. The following method is in class1 and I want to subscribe to the CEGUI::Window::EventDragDropItemLeaves a method out of class2. The compiler says there is no constructor which accepts 2 arguments, so I canĀ“t compile the program. But by subscribing a method of class1 to CEGUI::Window::EventDragDropItemEnters there are no probelms. Here is the code:
My Question now: What is wrong by using a method from another class then the subscribing function is in?
Code: Select all
CEGUI::Window* class1::createDragDropSlot(CEGUI::Window* parent, const CEGUI::UVector2& position, const CEGUI::UVector2& size, short parentname){
CEGUI::Window* slot = CEGUI::WindowManager::getSingleton().createWindow("TaharezLook/StaticImage");
parent->addChildWindow(slot);
slot->setPosition(position);
slot->setSize(size);
slot->subscribeEvent(CEGUI::Window::EventDragDropItemEnters, CEGUI::Event::Subscriber(&class1::handleDragEnter, this));
slot->subscribeEvent(CEGUI::Window::EventDragDropItemLeaves, CEGUI::Event::Subscriber(&class2::handleDragLeave, this));
slot->subscribeEvent(CEGUI::Window::EventDragDropItemDropped, CEGUI::Event::Subscriber(&class2::handleDragDropped, this));
return slot;
}
My Question now: What is wrong by using a method from another class then the subscribing function is in?