// Class prototype // --------------- function vDialog() { // Initialize functions // -------------------- this.vAlert = _vDialog_vAlert; this.vPrompt = _vDialog_vPrompt; // Functions prototype // ------------------- function _vDialog_vAlert(_vDialog_text, _vDialog_title, _vDialog_buttons, _vDialog_type, _vDialog_parent) { // _vDialog_text Text on vDialog // _vDialog_title Title of vDialog // _vDialog_buttons What kind of buttons should be on the vAlert: // "ok" // "okcancel" // "yesno" // _vDialog_type Type of from which this function has been called: // "vWindow" = vWindow.vAlert() // "vApp" = vApp.vAlert() // "" or "undefined" = vOS.vDialog.vAlert() // _vDialog_parent Object to parent which needs to be disabled/enabled var ondonecode = ""; // Keeps the code which will be executed when the vAlert window is closed if (_vDialog_type == "vWindow") { // Disable vWindow with the use of the _vDialog_parent variable _vDialog_parent.disable(); // Create some code which will be executed when the user clicks a button on the vAlert window ondonecode = "vAlert_parent.enable(); vAlert_parent.setActive(); vOS.arr_vApps[" + _vDialog_parent.vApp_pid + "].onEvent('" + _vDialog_parent.vWindow_name + "', null, 'vAlert', vAlert_returnvalue);"; } else if (_vDialog_type == "vApp") { // Disable all windows which come with the application _vDialog_parent.disable(); ondonecode = "vAlert_parent.enable(); vOS.arr_vApps[" + _vDialog_parent.vApp_pid + "].onEvent(null, null, 'vAlert', vAlert_returnvalue);"; } else { // Disable vOS completely vOS.disable(); // Check if a parent reference is added. If not, show the vAlert without providing a callback function if (_vDialog_type) { _vDialog_parent = _vDialog_type; _vDialog_type = ""; ondonecode = "vOS.enable(); vOS.arr_vApps[" + _vDialog_parent.vApp_pid + "].onEvent(null, null, 'vAlert', vAlert_returnvalue);"; } else { _vDialog_type = ""; ondonecode = "vOS.enable();"; } } // Load the application which will show the vAlert window vOS.run("programs/system/vAlert/vAlert.js", [_vDialog_text, _vDialog_title, _vDialog_buttons, _vDialog_type, _vDialog_parent, ondonecode]); } function _vDialog_vPrompt(_vDialog_text, _vDialog_title, _vDialog_default, _vDialog_type, _vDialog_parent) { // _vDialog_text Text on vDialog // _vDialog_title Title of vDialog // _vDialog_default Default value to show // _vDialog_type Type of from which this function has been called: // "vWindow" = vWindow.vPrompt() // "vApp" = vApp.vPrompt() // "" or "undefined" = vOS.vDialog.vPrompt() // _vDialog_parent Object to parent which needs to be disabled/enabled var ondonecode = ""; // Keeps the code which will be executed when the vPrompt window is closed if (_vDialog_type == "vWindow") { // Disable vWindow with the use of the _vDialog_parent variable _vDialog_parent.disable(); // Create some code which will be executed when the user clicks a button on the vAlert window ondonecode = "vPrompt_parent.enable(); vPrompt_parent.setActive(); vOS.arr_vApps[" + _vDialog_parent.vApp_pid + "].onEvent('" + _vDialog_parent.vWindow_name + "', null, 'vPrompt', vPrompt_returnvalue);"; } else if (_vDialog_type == "vApp") { // Disable all windows which come with the application _vDialog_parent.disable(); ondonecode = "vPrompt_parent.enable(); vOS.arr_vApps[" + _vDialog_parent.vApp_pid + "].onEvent(null, null, 'vPrompt', vPrompt_returnvalue);"; } else { // Disable vOS completely vOS.disable(); // Check if a parent reference is added. If not, show the vAlert without providing a callback function if (_vDialog_type) { _vDialog_parent = _vDialog_type; _vDialog_type = ""; ondonecode = "vOS.enable(); vOS.arr_vApps[" + _vDialog_parent.vApp_pid + "].onEvent(null, null, 'vPrompt', vPrompt_returnvalue);"; } else { _vDialog_type = ""; ondonecode = "vOS.enable();"; } } // Load the application which will show the vPrompt window vOS.run("programs/system/vPrompt/vPrompt.js", [_vDialog_text, _vDialog_title, _vDialog_default, _vDialog_type, _vDialog_parent, ondonecode]); } } add_counter(10);