Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dongyuwei/2144736 to your computer and use it in GitHub Desktop.
Save dongyuwei/2144736 to your computer and use it in GitHub Desktop.
Context menus in Titanium Desktop, a quick sample.
<html>
<body>
<style type="text/css">
body {
-webkit-user-select: auto !important;
}
</style>
Here is some text.
<br />
<textarea rows="10" cols="70">
This is a text area with text in it.
</textarea>
<br />
<script type="text/javascript">
var menu = Titanium.UI.createMenu();
menu.addItem('Cut', function() {
alert('cut');
});
menu.addItem('Copy', function() {
alert('copy');
});
menu.addItem('Paste', function() {
alert('paste');
});
Titanium.UI.getMainWindow().setContextMenu(menu);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment