Example #1
0
static int keypress_cb(Ihandle *ih, int c, int pressed)
{
  if (iup_isprint(c))
    printf("KEYPRESS_CB(%d = %s \'%c\' (%d))\n", c, iupKeyCodeToName(c), (char)c, pressed);
  else
    printf("KEYPRESS_CB(%d = %s (%d))\n", c, iupKeyCodeToName(c), pressed);
  return IUP_DEFAULT;
}
Example #2
0
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')\n", IupGetClassName(ih), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)\n", IupGetClassName(ih), c, iupKeyCodeToName(c));
  return IUP_CONTINUE;
}
Example #3
0
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"), c, iupKeyCodeToName(c));
  return IUP_DEFAULT;
}
Example #4
0
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%d = %s \'%c\')\n", c, iupKeyEncode(c), (char)c);
  else
    printf("K_ANY(%d = %s)\n", c, iupKeyEncode(c));
  return IUP_CONTINUE;
}
Example #5
0
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')\n", get_name(ih), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)\n", get_name(ih), c, iupKeyCodeToName(c));
  printf("  MODKEYSTATE(%s)\n", IupGetGlobal("MODKEYSTATE"));
  return IUP_DEFAULT;
}
Example #6
0
File: tree.c Project: Airr/iup_mac
static int k_any_cb(Ihandle* ih, int c)
{
  if (c == K_DEL) 
    IupSetAttribute(ih, "DELNODE", "MARKED");
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)\n", IupGetAttribute(IupGetParent(IupGetParent(ih)), "TITLE"), c, iupKeyCodeToName(c));
  return IUP_CONTINUE;
}
Example #7
0
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')\n", IupGetClassName(ih), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)\n", IupGetClassName(ih), c, iupKeyCodeToName(c));
  if (c==K_r) { IupRecordInput("inputtest.iup", IUP_RECTEXT); return IUP_IGNORE; }  //IUP_RECBINARY, IUP_RECTEXT 
  if (c==K_s) { IupRecordInput(NULL, 0); IupPlayInput(NULL); return IUP_IGNORE; }
  if (c==K_p) { IupPlayInput("inputtest.iup"); return IUP_IGNORE; }
  return IUP_CONTINUE;
}
Example #8
0
static int k_any(Ihandle *ih, int c)
{
  if (c == K_a)
    IupSetAttribute(ih, "POSX", "100");

  if (iup_isprint(c))
    printf("K_ANY(%d = %s \'%c\')\n", c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%d = %s)\n", c, iupKeyCodeToName(c));
  printf("  MODKEYSTATE(%s)\n", IupGetGlobal("MODKEYSTATE"));
  return IUP_DEFAULT;
}
Example #9
0
File: text.c Project: sanikoyes/iup
static int action(Ihandle *ih, int c, char* after)
{
  if (iup_isprint(c))
    printf("ACTION(%d = %s \'%c\', %s)\n", c, iupKeyCodeToName(c), (char)c, after);
  else
    printf("ACTION(%d = %s, %s)\n", c, iupKeyCodeToName(c), after);
  if (c == K_i)
    return IUP_IGNORE;   // OK
  if (c == K_cD)
    return IUP_IGNORE;   // Sound a beep in Windows
  if (c == K_h)
    return K_j;
  return IUP_DEFAULT;
}
Example #10
0
File: text.c Project: sanikoyes/iup
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%d = %s \'%c\')\n", c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%d = %s)\n", c, iupKeyCodeToName(c));
  printf("  CARET(%s)\n", IupGetAttribute(ih, "CARET"));
  if (c == K_cA)
    return IUP_IGNORE;   // Sound a beep in Windows
  if (c == K_cP)
  {
    file_open();
    return IUP_IGNORE;   // Sound a beep in Windows
  }
  return IUP_CONTINUE;
}
Example #11
0
static int iMatrixEditTextAction_CB(Ihandle* ih_text, int c, char* after)
{
    Ihandle* ih = ih_text->parent;
    IFniiiis cb = (IFniiiis) IupGetCallback(ih, "ACTION_CB");

    if (iupAttribGetBoolean(ih, "EDITFITVALUE"))
    {
        int value_w, value_h, resize = 0;

        value_w = iupdrvFontGetStringWidth(ih_text, after);
        iupdrvFontGetCharSize(ih_text, NULL, &value_h);

        if (iupAttribGetBoolean(ih_text, "BORDER"))
        {
            value_w += 2 * 4;
            value_h += 2 * 4;
        }

        if (value_w > ih_text->currentwidth)
        {
            ih_text->currentwidth = value_w;
            resize = 1;
        }
        if (value_h > ih_text->currentheight)
        {
            ih_text->currentheight = value_h;
            resize = 1;
        }

        if (resize)
            iupClassObjectLayoutUpdate(ih_text);
    }

    if (cb && iup_isprint(c)) /* only for keys that ARE ASCii characters */
    {
        int oldc = c;
        c = cb(ih, c, ih->data->edit_lin, ih->data->edit_col, 1, after);
        if (c == IUP_IGNORE || c == IUP_CLOSE || c == IUP_CONTINUE)
            return c;
        else if(c == IUP_DEFAULT)
            c = oldc;
        return c;
    }

    return IUP_DEFAULT;
}
Example #12
0
int iupMatrixKeyPress_CB(Ihandle* ih, int c, int press)
{
  int oldc = c;
  IFniiiis cb;

  if (!iupMatrixIsValid(ih, 1))
    return IUP_DEFAULT;

  if (!press)
    return IUP_DEFAULT;

  cb = (IFniiiis)IupGetCallback(ih, "ACTION_CB");
  if (cb)
  {
    if (iup_isprint(c))
    {
      char value[2]={0,0};
      value[0] = (char)c;
      c = cb(ih, c, ih->data->lines.focus_cell, ih->data->columns.focus_cell, 0, value);
    }
    else
    {
      c = cb(ih, c, ih->data->lines.focus_cell, ih->data->columns.focus_cell, 0,
             iupMatrixCellGetValue(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell));
    }

    if (c == IUP_IGNORE || c == IUP_CLOSE || c == IUP_CONTINUE)
      return c;
    else if (c == IUP_DEFAULT)
      c = oldc;
  }

  if (c != K_HOME && c != K_sHOME)
    ih->data->homekeycount = 0;
  if (c != K_END && c != K_sEND)
    ih->data->endkeycount = 0;

  return iupMatrixProcessKeyPress(ih, c);
}
Example #13
0
static int cf_isprint(lua_State *L)
{
  int value = luaL_checkint(L, 1);
  lua_pushinteger(L, iup_isprint(value));
  return 1;
}
Example #14
0
static int k_any(Ihandle *ih, int c)
{
  if (iup_isprint(c))
    printf("K_ANY(%s, %d = %s \'%c\')", IupGetAttribute(ih, "TESTTITLE"), c, iupKeyCodeToName(c), (char)c);
  else
    printf("K_ANY(%s, %d = %s)", IupGetAttribute(ih, "TESTTITLE"), c, iupKeyCodeToName(c));
  printf("  MODKEYSTATE(%s)\n", IupGetGlobal("MODKEYSTATE"));

  switch(c)
  {
  case K_r:
    IupSetAttribute(ih, "RASTERSIZE", "300x300");
    IupRefresh(ih);
    break;
  case K_1:
    new_dialog(1, "SIZE=FULLxFULL + IupShow.\n"
                  "Check also F1 = RASTERSIZE+IupRefresh.\n"
                  "close_cb returns IGNORE.");
    break;
  case K_2:
    new_dialog(2, "Only common dlg decorations.\n"
                  "ShowXY.\n"
                  "min/max size.");
    break;
  case K_3:
    new_dialog(3, "NO decorations");
    break;
  case K_4:
    new_dialog(4, "PLACEMENT.\n"
                  "Repeat key to test variations.");
    break;
  case K_5:
    new_dialog(5, "IupPopup");
    break;
  case K_6:
    new_dialog(6, "FULLSCREEN");
    break;
  case K_p:
    {
      static int count = 0;
      if (count == 0)
        IupSetAttribute(ih, "PLACEMENT", "MAXIMIZED");
      else if (count == 1)
        IupSetAttribute(ih, "PLACEMENT", "MINIMIZED");
      else if (count == 2)
        IupSetAttribute(ih, "PLACEMENT", "NORMAL");
      else 
        IupSetAttribute(ih, "PLACEMENT", "FULL");

      count++;
      if (count == 4) // cicle from 0 to 3
        count = 0;

      IupShow(ih);
    }
    break;
  case K_s:
    IupShow(IupGetHandle("_MAIN_DIALOG_TEST_"));
    break;
  case K_f:
    if (IupGetInt(ih, "FULLSCREEN"))
      IupSetAttribute(ih, "FULLSCREEN", "NO");
    else 
      IupSetAttribute(ih, "FULLSCREEN", "YES");
    break;
  case K_ESC:
    IupDestroy(ih);
    return IUP_IGNORE;
  case K_c:
    return IUP_CLOSE;
  case K_h:
    IupHide(ih);
    break;
  }
  return IUP_DEFAULT;
}
Example #15
0
static int iMatrixEditTextKeyAny_CB(Ihandle* ih, int c)
{
  Ihandle* ih_matrix = ih->parent;
  IFniiiis cb = (IFniiiis) IupGetCallback(ih_matrix, "ACTION_CB");
  if (cb && !iup_isprint(c)) /* only for other keys that are not characters */
  {
    int oldc = c;
    c = cb(ih_matrix, c, ih_matrix->data->lines.focus_cell, ih_matrix->data->columns.focus_cell, 1, IupGetAttribute(ih, "VALUE"));
    if(c == IUP_IGNORE || c == IUP_CLOSE || c == IUP_CONTINUE)
      return c;
    else if(c == IUP_DEFAULT)
      c = oldc;
  }

  switch (c)
  {
    case K_cUP:
    case K_cDOWN:
    case K_cLEFT:
    case K_cRIGHT:     
      if (iupMatrixEditHide(ih_matrix) == IUP_DEFAULT)
      {
        iupMatrixProcessKeyPress(ih_matrix, c);  
        return IUP_IGNORE;
      }
      break;
    case K_UP:
      if (IupGetInt(ih, "CARET") == 1)
      {
        /* if at the first line of the text */
        if (iupMatrixEditHide(ih_matrix) == IUP_DEFAULT)
        {
          iupMatrixProcessKeyPress(ih_matrix, c);  
          return IUP_IGNORE;
        }
      }
      break;
    case K_DOWN:
      { 
        char* value = IupGetAttribute(ih, "VALUE");
        if (value)
        {
          /* if at the last line of the text */
          if (iupStrLineCount(value) == IupGetInt(ih, "CARET"))
          {
            if (iupMatrixEditHide(ih_matrix) == IUP_DEFAULT)
            {
              iupMatrixProcessKeyPress(ih_matrix, c);  
              return IUP_IGNORE;
            }
          }
        }
      }
      break;
    case K_LEFT:
      if (IupGetInt(ih, "CARETPOS") == 0)
      {
        /* if at the first character */
        if (iupMatrixEditHide(ih_matrix) == IUP_DEFAULT)
        {
          iupMatrixProcessKeyPress(ih_matrix, c);  
          return IUP_IGNORE;
        }
      }
      break;
    case K_RIGHT:
      { 
        char* value = IupGetAttribute(ih, "VALUE");
        if (value)
        {
          /* if at the last character */
          if ((int)strlen(value) == IupGetInt(ih, "CARETPOS"))
          {
            if (iupMatrixEditHide(ih_matrix) == IUP_DEFAULT)
            {
              iupMatrixProcessKeyPress(ih_matrix, c);  
              return IUP_IGNORE;
            }
          }
        }
      }
      break;
    case K_ESC:
      iMatrixEditCancel(ih_matrix, 1, 0, 0); /* set focus + NO update + NO ignore */
      return IUP_IGNORE;  /* always ignore to avoid the defaultesc behavior from here */
    case K_CR:
      if (iupMatrixEditHide(ih_matrix) == IUP_DEFAULT)
      {
        if (iupStrEqualNoCase(IupGetGlobal("DRIVER"), "Win32") && IupGetInt(ih, "MULTILINE"))
        {
          /* work around for Windows when using Multiline */
          iupAttribSetStr(ih_matrix, "_IUPMAT_IGNORE_SHOW", "1");
        }

        if (iupMatrixAuxCallLeaveCellCb(ih_matrix) != IUP_IGNORE)
        {
          iupMATRIX_ScrollKeyCr(ih_matrix);
          iupMatrixAuxCallEnterCellCb(ih_matrix);
        }
        iupMatrixDrawUpdate(ih_matrix);
      }
      return IUP_IGNORE;  /* always ignore to avoid the defaultenter behavior from here */
  }

  return IUP_CONTINUE;
}
Example #16
0
static int iMatrixEditTextKeyAny_CB(Ihandle* ih_text, int c)
{
    Ihandle* ih = ih_text->parent;
    IFniiiis cb = (IFniiiis) IupGetCallback(ih, "ACTION_CB");
    if (cb && !iup_isprint(c)) /* only for keys that are NOT ASCii characters */
    {
        int oldc = c;
        c = cb(ih, c, ih->data->edit_lin, ih->data->edit_col, 1, IupGetAttribute(ih_text, "VALUE"));
        if(c == IUP_IGNORE || c == IUP_CLOSE || c == IUP_CONTINUE)
            return c;
        else if(c == IUP_DEFAULT)
            c = oldc;
    }

    switch (c)
    {
    case K_cUP:
    case K_cDOWN:
    case K_cLEFT:
    case K_cRIGHT:
        if (iupMatrixEditConfirm(ih) == IUP_DEFAULT)
        {
            iupMatrixProcessKeyPress(ih, c);
            return IUP_IGNORE;
        }
        break;
    case K_UP:
        if (!IupGetInt(ih_text, "MULTILINE") || IupGetInt(ih_text, "CARET") == 1)  /* if Multiline CARET will be "L,C" */
        {
            /* if at the first line of the text */
            if (iupMatrixEditConfirm(ih) == IUP_DEFAULT)
            {
                iupMatrixProcessKeyPress(ih, c);
                return IUP_IGNORE;
            }
        }
        break;
    case K_DOWN:
    {
        /* if at the last line of the text */
        if (!IupGetInt(ih_text, "MULTILINE") || IupGetInt(ih_text, "LINECOUNT") == IupGetInt(ih_text, "CARET"))  /* if Multiline CARET will be "L,C" */
        {
            if (iupMatrixEditConfirm(ih) == IUP_DEFAULT)
            {
                iupMatrixProcessKeyPress(ih, c);
                return IUP_IGNORE;
            }
        }
    }
    break;
    case K_LEFT:
        if (IupGetInt(ih_text, "CARETPOS") == 0)
        {
            /* if at the first character */
            if (iupMatrixEditConfirm(ih) == IUP_DEFAULT)
            {
                iupMatrixProcessKeyPress(ih, c);
                return IUP_IGNORE;
            }
        }
        break;
    case K_RIGHT:
    {
        /* if at the last character */
        if (IupGetInt(ih_text, "COUNT") == IupGetInt(ih_text, "CARETPOS"))
        {
            if (iupMatrixEditConfirm(ih) == IUP_DEFAULT)
            {
                iupMatrixProcessKeyPress(ih, c);
                return IUP_IGNORE;
            }
        }
    }
    break;
    case K_ESC:
        iupMatrixEditAbort(ih);
        return IUP_IGNORE;  /* always ignore to avoid the defaultesc behavior from here */
    case K_CR:
        if (iupMatrixEditConfirm(ih) == IUP_DEFAULT)
        {
            if (iupStrEqualNoCase(IupGetGlobal("DRIVER"), "Win32") && IupGetInt(ih_text, "MULTILINE"))
            {
                /* work around for Windows when using Multiline */
                iupAttribSet(ih, "_IUPMAT_IGNORE_SHOW", "1");
            }

            if (iupMatrixAuxCallLeaveCellCb(ih) != IUP_IGNORE)
            {
                iupMATRIX_ScrollKeyCr(ih);
                iupMatrixAuxCallEnterCellCb(ih);
            }
            iupMatrixDrawUpdate(ih);
        }
        return IUP_IGNORE;  /* always ignore to avoid the defaultenter behavior from here */
    }

    return IUP_CONTINUE;
}
Example #17
0
static void cf_isprint(void)
{
  int cod = luaL_check_int(1);
  lua_pushnumber(iup_isprint(cod));
}
Example #18
0
int iupMatrixProcessKeyPress(Ihandle* ih, int c)
{
  /* This function is also called from inside the keyboard callbacks 
     of the Text and Dropdown list when in edition mode */

  int ret = IUP_IGNORE; /* default for processed keys */

  /* Hide (off) the marked cells if the key is not tab/del */
  if (c != K_TAB && c != K_sTAB && c != K_DEL && c != K_sDEL)
    iupMatrixMarkClearAll(ih, 1);

  /* If the focus is not visible, a scroll is done for that the focus to be visible */
  if (!iupMatrixAuxIsCellFullVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell))
    iupMatrixScrollToVisible(ih, ih->data->lines.focus_cell, ih->data->columns.focus_cell);

  switch (c)
  {
    case K_CR+2000:   /* used by the iMatrixEditTextKeyAny_CB and iMatrixEditDropDownKeyAny_CB */
      if (iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyCr(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_cHOME:
    case K_sHOME:
    case K_HOME:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyHome(ih);
      ih->data->homekeycount++;
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_cEND:
    case K_sEND:
    case K_END:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyEnd(ih);
      ih->data->endkeycount++;
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_sTAB:
    case K_TAB:
      return IUP_CONTINUE;  /* do not redraw */

    case K_cLEFT:
    case K_sLEFT:
    case K_LEFT:
      if (iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyLeft(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_cRIGHT:
    case K_sRIGHT:
    case K_RIGHT:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyRight(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_cUP:
    case K_sUP:
    case K_UP:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyUp(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break ;

    case K_cDOWN:
    case K_sDOWN:
    case K_DOWN:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyDown(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_sPGUP:
    case K_PGUP:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyPgUp(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_sPGDN:
    case K_PGDN:
      if(iupMatrixAuxCallLeaveCellCb(ih) == IUP_IGNORE)
        break;
      iupMatrixScrollKeyPgDown(ih);
      iupMatrixAuxCallEnterCellCb(ih);
      break;

    case K_SP:
    case K_CR:
    case K_sCR:
      if (iupMatrixEditShow(ih))
        return IUP_IGNORE; /* do not redraw */
      break;

    case K_sDEL:
    case K_DEL:
      {
        int lin, col;
        char str[100];
        IFnii mark_cb = (IFnii)IupGetCallback(ih, "MARK_CB");

        iupMatrixPrepareDrawData(ih);

        for(lin = 1; lin < ih->data->lines.num; lin++)
        {
          for(col = 1; col < ih->data->columns.num; col++)
          {
            if (iupMatrixMarkCellGet(ih, lin, col, mark_cb, str))
            {
              if (iupMatrixAuxCallEditionCbLinCol(ih, lin, col, 1) != IUP_IGNORE)
              {
                IFniis value_edit_cb;

                iupMatrixCellSetValue(ih, lin, col, NULL);

                value_edit_cb = (IFniis)IupGetCallback(ih, "VALUE_EDIT_CB");
                if (value_edit_cb)
                  value_edit_cb(ih, lin, col, NULL);

                iupMatrixDrawCells(ih, lin, col, lin, col);
              }
            }
          }
        }
        break;
      }
    default:
      /* if a valid character is pressed enter edition mode */
      if (iup_isprint(c))
      {
        if (iupMatrixEditShow(ih))
        {
          if (ih->data->datah == ih->data->texth)
          {
            char value[2] = {0,0};
            value[0] = (char)c;
            IupStoreAttribute(ih->data->datah, "VALUE", value);
            IupSetAttribute(ih->data->datah, "CARET", "2");
          }
          return IUP_IGNORE; /* do not redraw */
        }
      }
      ret = IUP_DEFAULT; /* unprocessed keys */
      break;
  }

  iupMatrixDrawUpdate(ih);  
  return ret;
}
Example #19
0
static int iMatrixListKeyAny_CB(Ihandle *ih, int key)
{
  ImatrixListData* mtxList = (ImatrixListData*)iupAttribGet(ih, "_IUPMTXLIST_DATA");

  if (IupGetInt(ih, "EDITMODE"))
    return IUP_CONTINUE;

  if (key == K_SP || key == K_sSP)
  {
    if (mtxList->image_col != 0)
    {
      int lin = ih->data->lines.focus_cell;
      int itemactive = IupGetIntId(ih, "ITEMACTIVE", lin);
      int imageactive = IupGetIntId(ih, "IMAGEACTIVE", lin);
      int lines_num = ih->data->lines.num;

      if (!itemactive || !imageactive)
        return IUP_IGNORE;

      if (!mtxList->editable || lin != lines_num-1)
      {
        IFnii imagevaluechanged_cb = (IFnii)IupGetCallback(ih, "IMAGEVALUECHANGED_CB");
        int imagevalue = !IupGetIntId(ih, "IMAGEVALUE", lin);
        if (!imagevaluechanged_cb || imagevaluechanged_cb(ih, lin, imagevalue) != IUP_IGNORE)
        {
          IupSetIntId(ih, "IMAGEVALUE", lin, imagevalue);
          IupSetfAttribute(ih, "REDRAW", "L%d", lin);
          return IUP_IGNORE;
        }
      }

      return IUP_IGNORE;
    }
  }
  else if (key == K_HOME || key == K_sHOME)
  {
    iMatrixListSetFocusItem(ih, mtxList, 1);
    IupSetAttribute(ih, "SHOW", "1:*");
    return IUP_IGNORE;
  }
  else if (key == K_END || key == K_sEND)
  {
    iMatrixListSetFocusItem(ih, mtxList, ih->data->lines.num-1);
    IupSetfAttribute(ih, "SHOW", "%d:*", ih->data->lines.num-1);
    return IUP_IGNORE;
  }
  else if (key == K_DEL || key == K_sDEL)
  {
    if (mtxList->editable)
    {
      IFni listremove_cb = (IFni)IupGetCallback(ih, "LISTREMOVE_CB");
      /* notify the application that a line will be removed */
      int lin = ih->data->lines.focus_cell;
      int itemactive = IupGetIntId(ih, "ITEMACTIVE", lin);
      if (itemactive && (!listremove_cb || listremove_cb(ih, lin) != IUP_IGNORE))
      {
        /* Remove the line */
        IupSetInt(ih, "DELLIN", lin);
        return IUP_IGNORE;
      }
    }
  }
  else if (key == K_F2 || key == K_CR || key == K_sCR)
  {
    int lin = ih->data->lines.focus_cell;
    iMatrixListSetFocusItem(ih, mtxList, lin);  /* this will position focus at the right cell */
    IupSetAttribute(ih, "EDITMODE", "Yes");
    return IUP_IGNORE;
  }
  else
  {
    /* if a valid character is pressed enter edition mode */
    if (iup_isprint(key))
    {
      int lin = ih->data->lines.focus_cell;
      iMatrixListSetFocusItem(ih, mtxList, lin);  /* this will position focus at the right cell */

      IupSetAttribute(ih, "EDITMODE", "Yes");
      if (IupGetInt(ih, "EDITMODE"))
      {
        char value[2] = {0,0};
        value[0] = (char)key;
        IupStoreAttribute(ih->data->datah, "VALUEMASKED", value);
        IupSetAttribute(ih->data->datah, "CARET", "2");
        return IUP_IGNORE;
      }
    }
  }

  return IUP_CONTINUE;
}