|
I’ve got the following working:
1. Multiple tabs
2. Each tab supports it’s own scripting language (jscript, python, vb)
3. All the goodness of Scintilla (color coding, auto-completion etc)
What’s driving me insane is, perhaps a buggy, siUIToolbar for the Text Editor Widget:
1. Edit menu missing completely
2. File > Open, File > New don’t do anything. I have a feeling I need to set more attributes to make this work, perhaps setFolder or something similar.
I’ve written to SI about the siUIToolbar, hopefully they’ll be able to sort it out soon enough. If anyone else knows what I’m doing wrong, do tell :)
Note: Right now the keyword file path is disabled. I’m reading up on what format the keyword file should be. Different colours for different things etc.
Here’s the latest code:
var oPSet = ActiveSceneRoot.AddProperty("CustomProperty", false, "scriptEditor");
var oLayout = oPSet.PPGLayout;
oLayout.Logic = runCode_OnClicked.toString() +
oLayout.Clear();
for (var i = 0;i < 5;i++) {
editorID = "x" + i;
oLayout.AddTab(editorID);
oPSet.AddParameter3(editorID, siString, "");
oPSet.AddParameter3("combo"+editorID, siString, "JScript");
//oLayout.AddGroup("Editor");
oLayout.AddRow();
oRunBttn = oLayout.AddButton("runCode", "Run");
oLayout.Language = "JScript";
var lingoArray = new Array("JScript","JScript",
"Python","Python",
"VB Script", "VBScript");
oLingoCB = oLayout.AddEnumControl("combo"+editorID, lingoArray, "Language", siControlCombo);
oLingoCB.SetAttribute(siUINoLabel, true);
oLingoCB.SetAttribute(siUICX, 100);
oLayout.EndRow();
oItem = oLayout.AddItem(editorID, "", siControlTextEditor );
oItem.SetAttribute(siUIToolbar, true);
oItem.SetAttribute(siUIHeight, 400);
oItem.SetAttribute(siUILineNumbering, true);
oItem.SetAttribute(siUIMarginWidth, 3);
oItem.SetAttribute(siUIFolding, true);
oItem.SetAttribute(siUINoLabel, true);
oItem.SetAttribute(siUIFont, "Tahoma");
oItem.SetAttribute(siUICommentFont, "Comic Sans MS" );
oItem.SetAttribute(siUILanguage, "JScript");
//oItem.SetAttribute(siUIKeywordFile, "C:\\Softimage\\XSI_7.0\\Doc\\syntaxHighlight\\python.keywords");
oItem.SetAttribute(siUIAutoComplete, siKeywords)
oItem.SetAttribute(siUILineWrap, false);
oItem.SetAttribute(siUIHorizontalScroll, true);
oItem.SetAttribute(siUIVerticalScroll, true);
//oLayout.endGroup(); }
function runCode_OnClicked() {
currentLingoPath = PPG.name + ".combo" + PPG.CurrentTab;
currentLingo = Dictionary.GetObject(currentLingoPath);
currentEditorPath = PPG.name + "." + PPG.CurrentTab; //get editortextbox value
oEditorObj = Dictionary.GetObject(currentEditorPath); //conver to obj
oScript = oEditorObj.value;
var executeLingo = currentLingo.value;
try {
ExecuteScriptCode(oScript.toString(), executeLingo);
}
catch(e) {
LogMessage("Error: " + e.description);
}
}
InspectObj(oPSet);
|