--[[ alternative prompt function prompt(question, title, default, history) Show a modal 'prompt' dialog that returns a string value. This dialog has combobox instead of editbox. question, title, default : string history : table : return : string ]] require "dialog" local dlg; dlg = create_dialog({ style = w32dlg.DS_MODALFRAME + w32dlg.WS_POPUP + w32dlg.WS_VISIBLE + w32dlg.WS_CAPTION + w32dlg.WS_SYSMENU, exstyle = 0, x = 0, y = 0, width = 250, height = 65, caption = "Prompt", { type = "combobox", style = w32dlg.CBS_DROPDOWN + w32dlg.CBS_AUTOHSCROLL + w32dlg.WS_TABSTOP, x = 5, y = 20, width = 235, height = 50, id = "ID_ANSWER", }, { type = "button", style = w32dlg.BS_DEFPUSHBUTTON + w32dlg.WS_TABSTOP, x = 130, y = 35, width = 50, height = 14, id = "ID_OK", caption = "OK", }, { type = "button", style = w32dlg.BS_PUSHBUTTON + w32dlg.WS_TABSTOP, x = 190, y = 35, width = 50, height = 14, id = "ID_CANCEL", caption = "Cancel", }, { type = "static", x = 10, y = 5, width = 230, height = 13, id = "ID_STATIC", caption = "Prompt", } }) local default_history = {} function prompt(question, title, default, history) local result, tbl if not history then history = default_history end result, tbl = dlg(title, { ID_ANSWER = {default, history}, ID_STATIC = question }) if result == "ID_OK" then table.insert(history, 1, tbl.ID_ANSWER) return tbl.ID_ANSWER end end