Monday, November 08, 2010 at 12:06 AM.
system.verbs.builtins.table.promptNewItem
on promptNewItem (name, type) { local (adr); wp.setTextMode (false); local (cursor = table.getCursor ()); loop { <<prompt user for name, and make sure it's unique local (prompt = string.lower (name - "new")); if not dialog.ask ("Name for new " + prompt + " cell?", @name) { return (false)}; local (s = table.getCursor ()); s = string (parentof (s^) + ".[\"" + name + "\"]"); adr = address (s); if not defined (adr^) { <<it's unique break}; if dialog.yesNo ("Replace existing \"" + name + "\"?") { break}}; case type { 'CARD' { adr^ = card.data.emptyCard}} else { new (type, adr)}; bundle { <<if cursor was on new, "unknown" item, delete it if (cursor != "") and (typeOf (cursor^) == unknownType) { editMenu.clear ()}}; <<table.gotoAddress (adr) <<Monday, July 28, 1997 at 9:44:50 PM by PBS table.gotoName (name); sys.systemtask (); return (true)}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.