I noticed that between DS 1.8 and 2.06, Tabs don't display in Dialogs created in advance.
See the code below : tabs are always visible in 1.8, they are only displayed when called from OnStart() in 2.06.
Is it a bug or a feature ? How can I reorganize my code ? I need to display the Dialogs many times, so it must be of "create once, use many" type. Hence my "object oriented" approach.
cfg.Holo;
//Called when application is started.
function OnStart()
{
//Initialize the Dialog Object
OBJECTDLG.Initialize();
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
//Create a button 1/3 of screen width and 1/10 screen height.
btn = app.CreateButton( "Press Me", 0.3, 0.1 );
btn.SetMargins( 0, 0.05, 0, 0 );
lay.AddChild( btn );
//Set function to call when button pressed.
btn.SetOnTouch( I( btn_OnTouch ));
//Add layout to app.
app.AddLayout( lay );
// Tabs do show off when Dialog is called from here
// OBJECTDLG.ShowDlg();
}
//Called when user touches our button.
function btn_OnTouch()
{
//Call to Show function of Object Dialog
// Tabs do NOT show off when Dialog is called from here
OBJECTDLG.ShowDlg();
// neither does this work :
// dlg.Show();
}
var OBJECTDLG = {
Initialize: function () {
dlg = app.CreateDialog( "This is a Tabbed Dialog" );
this.Objectdlg = dlg;
layDlg = app.CreateLayout( "linear", "VCenter,FillXY" );
layDlg.SetSize( 0.7, -1 );
dlg.AddLayout( layDlg );
tabs = app.CreateTabs( "Controls,Groups,Screens", -1, -1, "VCenter" );
layDlg.AddChild (tabs);
},
ShowDlg: function () {
this.Objectdlg.Show();
// neither does this work :
// dlg.Show();
}
};