[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Document.current isNil bug



think i know one way this can happen now.  if you for example modify your
Server.makeWindow to create a borderless gui, or do something else so that any
_document_ is in front right after startup/recompile, then that document isn't
the current one.  the classvar current will be nil until you switch to another
doc.

Document-startup looks like this:

*startup {
	var num, doc;

	num = this.numberOfOpen;
	num.do({arg i;
		doc = this.newFromIndex(i);
	});
}

(why the doc= here btw?)
here's my hack around the problem.  not very smart but it will at least avoids
the nil issue.  better would be if last current doc somehow could survive a
recompile.

*startup {
	var num, doc;

	num = this.numberOfOpen;
	num.do({arg i;
		doc = this.newFromIndex(i);
	});
	this.current= doc;
	doc.front;
}



also didBecomeKey in EnvirDocument lacks this line...
this.class.current = this;
correct?


and last i also wonder why a borderless SCWindow can't become front and respond
to keydowns?

a= SCWindow.new(border:false).front;
//still in the document typing
SCNumberBox(a, Rect(10, 20, 30, 40)).focus;
//and even with a focused view
a.close;


/f0


  #|
     fredrikolofsson.com     klippav.org     musicalfieldsforever.com
  |#