Customizable tidesdk dialog

I am working on a TideSDK project and I want to create a configuration settings window for my application, but I have not seen any documentation on how to do something similar on the website or in any accompanying documentation.

I am familiar with web development, and in the browser I would use target = new (or something like that) to note that I want the url to open in a new window, but I did not see anything like it at high tide.

I also tried to use the tide dialog functions, but it looks like windows will only refer to html files that are in the application directory (which means that it will not be embedded or will not be packaged with the application).

Is this feature available in tidsdk, or will I need to find an alternative way to create a settings / configuration window?

+4
source share
1 answer

I looked through the dialogue functions and found a way to do exactly what you want! The API documentation is not entirely clear, I had to try ...

Code example

In the main window:

//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}); 

In config.html :

 //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); 

Description

So ... In the main window, you create a dialog box with Ti.UI.showDialog and pass it a callback ( params.onclose , see above). In the dialog box, as soon as the user has set his configuration parameters via the html interface, you can simply save the configuration data in the object and pass it to the window closing method, and it will be passed to the callback in the main window.

Notes

Ti.UI.showDialog actually calls Ti.UI.createWindow and returns a Ti.UI.UserWindow object with some added fields and methods related to the dialog parameters, the result, and the closed callback.

Dialog parameters passed using Ti.UI.showDialog({url:"...",parameters:{...}}) can be accessed from the dialog using Ti.UI.getCurrentWindow().getDialogParameter("name") or Ti.UI.getCurrentWindow()._dialogParameters["name"] .

+5
source

All Articles