Pastey sl_input.e
- Posted by irv Oct 15, 2020
namespace input include GtkEngine.e constant -- persistent single-line input form with prompt; dlg = create(GtkDialog,"name=input_dialog"), pan = get(dlg,"content area"), lbl = create(GtkLabel,"name=input_label"), inp = create(GtkEntry,"name=input_entry") add(pan,{lbl,inp}) show(lbl) show(inp) set(dlg,"add button","gtk-cancel",MB_CANCEL) set(dlg,"add button","gtk-ok",MB_OK) set(dlg,"default response",MB_OK) connect(inp,"activate",_("CloseDlg"),dlg) --------------------------------------------------- global function Input(object prompt, object data=0) --------------------------------------------------- object result = OBJ_UNASSIGNED integer x set("input_dialog.transient for",pointer("MainWin")) set("input_label.text",prompt) if string(data) then set("input_entry.text",data) end if x = run("input_dialog") hide("input_dialog") if x = MB_OK then result = get("input_entry.text") end if return result end function -------------------------------------- function CloseDlg(atom ctl, atom dlg) -------------------------------------- set("input_dialog.response",MB_OK) return 1 end function
1. Comment by irv Oct 15, 2020
This is a simple pop-up dialog with a prompt and input field, for entering name of dbase, table, etc to open,create, etc.