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(); }
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"); }
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; }
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"); }
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; }