Hi, me again. I don't mean to be a pain but I have another question. I'm trying to add an event handler to the code (Irrlicht game engine) but I can't seem to retrieve data from the main function to the event class. Below I have bool check = ((IGUICheckBox*)event.GUIEvent.Caller)->isChecked(); which doesn't report any errors but on the same token doesn't return any information. Does anybody know what I'm doing wrong as I have RTFM but still the manual isn't giving the full answer.

virtual bool OnEvent(const SEvent& event)
		if (event.EventType == EET_GUI_EVENT)
			s32 id = event.GUIEvent.Caller->getID();
			IGUIEnvironment* env = Context.device->getGUIEnvironment();
                        //attempt to get data from main function
			bool check = ((IGUICheckBox*)event.GUIEvent.Caller)->isChecked();
						if (check==true) {
							std::cout << "true true true" << std::endl;
					} return true;

Above is a section of the event handler I'm using and below is the checksnd variable being assigned in the main function. It is this checksnd variable that I need to retrieve in the event handler and appears as undefined in the event handler.

IGUICheckBox* checksnd = env->addCheckBox( true, rect<s32>(170,40,320,60));


I just found the problem. It was a completely different unrelated piece of code that I accidentally deleted or that is commented. After uncommenting that code it all worked. But I will keep this thread open for soon bound to come problems in relation to this project.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.