mobileFX WebKitX ActiveX
WebKitX JavaScript Externs~-_namespace / ReadTextFile Method
Absolute path and file name to read UTF-8 text from.
In This Topic
    ReadTextFile Method
    In This Topic
    ReadTextFile read UTF-8 text from a file.

     

    Syntax
    var value; // Type: string
    
    // Parameters
    var FileName; // Type:  string
    
    value = ReadTextFile(FileName);
    function ReadTextFile( 
       FileName : string
    ) : string;

    Parameters

    FileName
    Absolute path and file name to read UTF-8 text from.
    Example
    function OnDesignerOpenForm()
    {
    	var title = "Open WebForm";
    	var path = APP_PATH;
    	var filter = "WebForm JSON File|*.json|All Files|*.*";
    	var filename = ShowOpenFileDialog(title, path, filter);
    
    	if (filename)
    	{
    		try
    		{
    			w2ui_webform_destroy();
    
    			var json = ReadTextFile(filename);
    			var FORM = JSON.parse(json);
    
    			W2_CONTROL_INDEX = FORM.W2_CONTROL_INDEX;
    			var index = 0;
    			WEB_FORM = null;
    
    			function _async_insert()
    			{
    				var control = FORM.CONTROLS[index];
    				var w2json = w2ui_control_add(control, false);
    
    				if (!WEB_FORM && w2json.w2type == "w2webform") 
    				{
    					WEB_FORM = w2json;
    					WEB_FORM.filename = filename;
    				}
    
    				if (++index < FORM.CONTROLS.length)
    				{
    					window.setTimeout(_async_insert, 0);
    				}
    				else
    				{
    					AttachDragDrop();					
    					EditorRefreshDatabaseSchema();
    					PropGridPopulateComboBox();					
    
    					CLIENT_TIER.model.setValue(FORM.CLIENT_TIER_SCRIPT || "");										
    					CLIENT_TIER.viewstate = FORM.CLIENT_TIER_VIEW || null;
    
    					SERVER_TIER.model.setValue(FORM.SERVER_TIER_SCRIPT || "");										
    					SERVER_TIER.viewstate = FORM.SERVER_TIER_VIEW || null;
    
    					EditorSetSqlStatements(FORM.SQL_STATEMENTS || []);					
    										
    					EditorSetModelBreakPoints(CLIENT_TIER.model, FORM.CLIENT_BREAKPOINTS || []);
    					EditorSetModelBreakPoints(SERVER_TIER.model, FORM.SERVER_BREAKPOINTS || []);
    
    					EditorLoadCodeFromCurrentTierModel();
    					EditorRefreshControlDeclarations();					
    					EditorRefreshSQLDeclarations();					
    				}
    			}
    
    			window.setTimeout(_async_insert, 0);
    		}
    		catch (e)
    		{
    		}
    	}
    }
    Browser Compatibility
    80