Hi all,
I'd like to change an older Vegas JScript script such that in a Windows Form a TextBox content is dynamically cleared upon selecting any item in a ListBox. I tried to search via Google and MSDN - but the only solutions I found were for C#, Javascript or Powershell. It seems to be really hard to restrict search to JScript, as Google interprets this as Javascript *sigh*. Based upon Powershell and C# code fragments, I tried the following skeleton, more by guessing than anything else, and of course without success:
import System; import System.Windows.Forms; import System.Drawing; import ScriptPortal.Vegas; ... class trackDialog extends Form { var trackList: ListBox; var textBox: TextBox; ... // handler : EventArgs is unknown... function trackList_OnSelect(source: Object, e:EventArgs) { textBox.Text = ""; } .. // Constructor: function trackDialog() { trackList = new ListBox(); textBox = new TextBox(); ... // register handler: add_selectedIndexChanged is unknown trackList.add_selectedIndexChanged(trackList_OnSelect); .... Controls.Add(textBox); Controls.Add(trackList); .... } }
I guess you get the idea what I'm trying to do... I would not like to change the whole script to C# just because of this detail and hope, there's a way to do this in JScript as well? Many thanks in advance.
Andy
EDIT: I found a solution meanwhile, just using add_Click generally and then checking the selected index, like this:
class trackDialog extends Form { var trackList: ListBox; var textBox: TextBox; ... function trackList_OnClick(source: Object, e:System.EventArgs) { if (trackList.SelectedIndices.Count == 0) { // nothing selected return; } textBox.Text = trackList.Items(trackList.SelectedIndices[0]); } .. // Constructor: function trackDialog() { trackList = new ListBox(); textBox = new TextBox(); ... // register handler: add_selectedIndexChanged is unknown trackList.add_Click(this.trackList_OnClick); .... Controls.Add(textBox); Controls.Add(trackList); .... } }