Monday, November 08, 2010 at 12:07 AM.


on edit (adr, windowTitle=nil, flReadOnly=false, adrButtonTable=nil) {
	<<Open a window for editing. Return the address of the previous target.
			<<08/14/00; 2:29:34 PM by PBS
				<<Instead of using a try statement to determine if it's a window-based object or a scalar, use a case statement. Supply the flReadOnly parameter to only if this is 7.0b6 or greater.
				<<If you're using 7.0b5 or earlier, then the flReadOnly parameter has no effect, but it can still be passed to this script without causing an error.
			<<11/2/01; 10:46:03 AM by BS
				<<adrButtonTable is a new optional parameter. If set, it's the address of a table of scripts to attach to buttons in an outline window.
	if defined (adr^) { //is it defined?
		case typeOf (adr^) { //is it a window-based object?
			wpTextType {
				local (oldtarget = target.set (adr));
				if windowTitle != nil {
					window.setTitle (adr, windowTitle)};
				if date.versionLessThan (Frontier.version (), "7.0b6") { (adr)} //flReadOnly not yet supported
				else {
					if (adrButtonTable != nil) and (not (date.versionLessThan (Frontier.version (), "7.1b18"))) { (adr, flReadOnly, adrButtonTable)}
					else { (adr, flReadOnly)}};
				return (oldTarget)}}};
	<<It's a scalar or it's not defined.
	local (oldtarget = target.get ());
	on kernelcall (adr) {
		kernel (lang.edit)};
	kernelcall (adr)}

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.