looks like when you have an event receiver attached, it captures all input and directs it through the receiver. it appears to make the BMAX input mechanisms act a little funky. i take you are using the terrain example. make device global add this to the event receiver under the IF that handles the wireframe toggle:
If (event.getEventType()=EET_KEY_INPUT_EVENT And .. event.getKeyPressedDown()=False And .. event.getKeyInputKey()=gg.Irrlicht.KEY_ESCAPE) device.closeDevice() EndIf