Exemplo n.º 1
0
static void GetText(void)
{
  char buffer[10240];
  strcpy(buffer, luaL_check_string(2));
  if(IupGetText(luaL_check_string(1), buffer))
    lua_pushstring(buffer);
  else
    lua_pushnil();
}
Exemplo n.º 2
0
static void new_gettext(void)
{
  char text[1024] = "text first line\nsecond line";
  int ret = IupGetText("IupGetText Text", text);
  if (ret)
  {
    printf("OK\n");
    printf("Text(%s)\n", text);
  }
  else
    printf("CANCEL\n");
}
Exemplo n.º 3
0
static int GetText(lua_State *L)
{
  char buffer[10240];
  const char *title = luaL_checkstring(L,1);
  const char *text = luaL_checkstring(L,2);
  iupStrCopyN(buffer, 10240, text);
  if (IupGetText(title, buffer))
  {
    lua_pushstring(L, buffer);
    return 1;
  }
  return 0;
}
Exemplo n.º 4
0
static void new_gettext(void)
{
  int ret;
  char text[1024] = "text first line\nsecond line";
  IupSetGlobal("PARENTDIALOG", "_MAIN_DIALOG_TEST_");
  ret = IupGetText("IupGetText Text", text);
  IupSetGlobal("PARENTDIALOG", NULL);
  if (ret)
  {
    printf("OK\n");
    printf("Text(%s)\n", text);
  }
  else
    printf("CANCEL\n");
}
Exemplo n.º 5
0
static int GetText(lua_State *L)
{
  char* buffer;
  const char *title = luaL_checkstring(L,1);
  const char *text = luaL_checkstring(L,2);
  int maxsize = (int)luaL_optinteger(L, 3, 10240);
  buffer = malloc(maxsize+1);
  iupStrCopyN(buffer, maxsize, text);
  if (IupGetText(title, buffer, maxsize))
  {
    lua_pushstring(L, buffer);
    free(buffer);
    return 1;
  }
  free(buffer);
  return 0;
}