Skip to content

Instantly share code, notes, and snippets.

@hugolpz
Forked from asiviero/child_window.js
Created December 17, 2015 15:37
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 hugolpz/38832f1691fc3fdead50 to your computer and use it in GitHub Desktop.
Save hugolpz/38832f1691fc3fdead50 to your computer and use it in GitHub Desktop.
Open a child window on Alloy/Titanium
$.child_window.open();
<Alloy>
<Window id="child_window">
<Label>This is the Child Window</Label>
</Window>
</Alloy>
$.button.addEventListener('click', function(e) {
child_window = Alloy.createController('child_window');
// Since the controller calls the open() function, nothing
// else is needed here
})
<Alloy>
<Window id="parent_window">
<Button id="button">Open Child Window</Button>
</Window>
</Alloy>
@hugolpz
Copy link
Author

hugolpz commented Dec 17, 2015

parent.xml:
<Button onClick="button">Open Child Window</Button>

parent.js

function button(e) { child_window = Alloy.createController('child_window'); // Since the controller calls the open() function, nothing // else is needed here }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment