public override bool HandleEvent(GUIEvent guiEvent) { bool handled = base.HandleEvent(guiEvent); if (guiEvent is GUIEventKeyReleased) { GUIEventKeyReleased guiEventKey = (GUIEventKeyReleased)guiEvent; if (guiEventKey.key == Sdl.SDLK_RETURN) { Close(); handled = true; } } return(handled); }
public override bool HandleEvent(GUIEvent guiEvent) { bool handled = false; if (guiEvent is GUIEventKeyReleased) { //Manejo el cierre del dialogo en el KeyReleased para que no le llegue a la ventana //padre el cierre por error GUIEventKeyReleased guiEventKey = (GUIEventKeyReleased)guiEvent; if (guiEventKey.key == Sdl.SDLK_ESCAPE) { Close(); handled = true; } } return(handled); }
public override bool HandleEvent(GUIEvent guiEvent) { bool handled = false; bool pressed = false; if (guiEvent is GUIEventMouseButtonPressed) { pressed = true; handled = true; } else if (guiEvent is GUIEventMouseButtonReleased) { handled = true; } else if (guiEvent is GUIEventMouseMoved) { handled = true; GUIEventMouseMoved g = (GUIEventMouseMoved)guiEvent; if (pressed == true) { if (g.position.X < 0 || g.position.Y < 0 || g.position.X >= Size.Width || g.position.Y >= Size.Height) { pressed = false; } } } else if (guiEvent is GUIEventKeyPressed) { GUIEventKeyPressed guiEventKey = (GUIEventKeyPressed)guiEvent; if (guiEventKey.key == Sdl.SDLK_DOWN || guiEventKey.key == Sdl.SDLK_RIGHT) { Father.FocusNextChild(); handled = true; } else if (guiEventKey.key == Sdl.SDLK_UP || guiEventKey.key == Sdl.SDLK_LEFT) { Father.FocusPreviusChild(); handled = true; } } else if (guiEvent is GUIEventKeyReleased) { GUIEventKeyReleased guiEventKey = (GUIEventKeyReleased)guiEvent; if (guiEventKey.key == Sdl.SDLK_SPACE || guiEventKey.key == Sdl.SDLK_RETURN) { pressed = true; handled = true; } } if (pressed) { if (ButtonPressed != null) { ButtonPressed(this); } } return(handled); }