Scide split tip

Hi,
i’m turning around the split option of scide, where scide have 2 splits (1-left & 1-right).
How to force A.scd to be open on the left side, B.scd on the right side.
the idea is to open those documents with a midiKeyboard.
The following code is not perfect but is usable. Is there a better method ?
(
var path = “/home/blabla/splits/”; // who’s contain files
MIDIdef.noteOn(\changeThe2Splits, {|v,n|
Routine{
Document.closeAll;
wait(s.latency); // s.latency : why not ? what’s better ?
// How to open :
Document.open(path ++ n ++"_left.scd"); // on the left split
Document.open(path ++ n ++"_right.scd");// on the right split
}.play(AppClock);
})
)

i finally find a better method to change splits text ; more cpu friendly, no eyes glitchs and can manage easily more than 2 splits. This make, i think, a SuperBlocNote !

code

(
// first make the events
var def = ();
def[\syntest] = Array.fill(128, {|i|
“(\nSynthDef(\\s%, {\n\t\n}).add\n)”
.format(i)});
def[\pattest] = Array.fill(128, {|i|
“(\nPdef(\\p%, Pbind(\n\t\instrument, \\s%,\n\t\n)).play\n)”
.format(i, i)});
Archive.global.put(\scide_split_tip, def);
)
// make “recept-document”
~splits = [\synth, \pattern].collect{|str| Document.new(str).promptToSave_(false)};

(
var trk=0, archive=Archive.global[\scide_split_tip];
MIDIdef.noteOn(\non, {|v,n,c|
case
{c==0}{
archive[\syntest][n].interpret;
~splits[0].text_(archive[\syntest][n]);
~splits[1].text_(archive[\pattest][n]);
trk=n;
}
{c==1}{case
{n==0}{
archive[\syntest][trk] = ~splits[0].string;
archive[\pattest][trk] = ~splits[1].string
}
}
}).permanent_(true);
MIDIIn.doNoteOnAction(0,0,0,1);
)

MIDIIn.doNoteOnAction(0,0,2,1); // change ‘program’

MIDIIn.doNoteOnAction(0,1,0,1) // SAVE

~splits.do(_.close)
/* to destroy the array on Archive.global :
Archive.global.removeAt(\scide_split_tip)
*/

i’m now learning about Document.keyDownAction but it can be better to intercept the Shift/Ctrl-Return exception to make something like : is there an error ?
yes> don’t write on archive - do something else
no>write the split text on archive
Is it possible ?
Other question, is there a technique/extension to make a split or a docklet show a QWindow with knobs, buttons… ?