#include <WScom.h>
#include <numfield.h>
#include <WSCbase.h>
//----------------------------------------------------------
//Function for the event procedure
//----------------------------------------------------------
#include <WSDkeyboard.h>

void numfield::numkey(WSCbase* object){
  numfield* base = (numfield*)object->getUserData(WS_BASE_CLASS);

  //get key code from keyboard instance.
  long key = WSGIappKeyboard()->getKey();
  if ( (key >= WSK_0    && key <= WSK_9   ) ||
       (key >= WSK_KP_0 && key <= WSK_KP_9) ||
        key == WSK_plus      || key == WSK_minus  ||
        key == WSK_BackSpace || key == WSK_Delete || key == WSK_Insert ||
        key == WSK_space     || key == WSK_Up     || key == WSK_Down   ||
        key == WSK_Left      || key == WSK_Right  || key == WSK_Return ){
    //number is OK
    return;
  }
  //other key into trush...
  WSGIappKeyboard()->setKey(0);

}
