Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I looked into the dialog functions, and found a way to do exactly what you want! The API documentation isn't very clear about this, I had to try around...</p> <h2>Example code</h2> <p>In the main window:</p> <pre class="lang-js prettyprint-override"><code>//Example function to apply configuration function applyConfig(configObject){ setSomething(configObject.field); ... } //Create a dialog, and give it the above function as an `onclose` callback: var dialog=Ti.UI.showDialog({url:"app://config.html",onclose:applyConfig}); </code></pre> <p>In <code>config.html</code>:</p> <pre class="lang-js prettyprint-override"><code>//An example of an object that could hold your config data var config={field:0,example:"hello",...}; //Function to call in order to pass that object back to the main window callback: Ti.UI.getCurrentWindow().close(config); </code></pre> <h2>Explanation</h2> <p>So... In your main window, you create a dialog window with <code>Ti.UI.showDialog</code> and pass it a callback (<code>params.onclose</code>, see above). In the dialog window, once the user has set his configuration options through the html interface, you can just save the configuration data in an object, and pass it to the window's close method, and it will be passed to the callback in the main window.</p> <h2>Notes</h2> <p><code>Ti.UI.showDialog</code> actually calls <code>Ti.UI.createWindow</code>, and returns a <code>Ti.UI.UserWindow</code> object, with some added fields and methods related to the dialog's parameters, result, and onclose callback.</p> <p>Dialog parameters passed with <code>Ti.UI.showDialog({url:"...",parameters:{...}})</code> can be accessed from inside the dialog window using <code>Ti.UI.getCurrentWindow().getDialogParameter("name")</code> or <code>Ti.UI.getCurrentWindow()._dialogParameters["name"]</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload