Skip to content

Instantly share code, notes, and snippets.

@DinisCruz
Created July 18, 2012 13:57
Show Gist options
  • Select an option

  • Save DinisCruz/3136362 to your computer and use it in GitHub Desktop.

Select an option

Save DinisCruz/3136362 to your computer and use it in GitHub Desktop.
O2 Script to create a mini NotePad (with only open and save Function)
//var topPanel = "{name}".popupWindow(700,400);
var topPanel = panel.clear().add_Panel();
var textBox = topPanel.add_TextBox(true)
.set_Text("hello world").wordWrap(true);
Action<string> openFile =
(file)=> textBox.set_Text(file.fileContents());
Action saveFile =
()=> textBox.get_Text().saveAs(topPanel.askUserForFileToSave(""));
topPanel.mainMenu().clear().add_Menu("File")
.add("Open", ()=> openFile(topPanel.askUserForFileToOpen()))
.add("Save", ()=> saveFile());
textBox.onDrop(openFile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment