Represents window where this script is runnung.
view - current view object (of the running script) is accessible through gloabal view variable.
| WINDOW_MINIMIZED WINDOW_MAXIMIZED WINDOW_HIDDEN |
Values of view.state property. |
Properties | |
| root | r - Element, root element of a document loaded into the view. |
| state | r/w - state of the view's window. Applicable only for toplevel frame windows (sciter.exe). |
| focus | r/w - Element, current element that has input focus. To set new element in focus use view.focus = el; |
| eventsRoot |
r/w - Element, "events root" element. Used for implementation of "modal document loops". If set then all UI events that are targeted to elements that are not descendants of the element will be rerouted to the element. Setting this element may cause current focus element to be changed. Here is typical modal document loop:
view.eventsRoot = dlg; while (dlg.isVisible) view.doEvent(); dlg.style#display = "none"; view.eventsRoot = null; |
| sip | r/w - show/hide SIP button of dialog. By default SIP button is hidden. (Windows Mobile Professional only!) |
| sipUp | r/w - show/hide SIP of dialog (keyboard). By default SIP is hidden. (Windows Mobile Professional only!) |
| fullscreen | r/w - make a window/dialog fullscreen. Note that menu visibility should be controlled via view.menu.visible. (Windows Mobile Professional only!) |
| menu | r - returns an object of type Menu of the view. (Windows Mobile Professional only!) |
Methods | |
| (non-constructable) | |
| load |
(url:string[, now: bool]) : true/false
Method loads new document (replaces current one) in the current view from the given url. If now is equal to true this method loads document synchronously - method will return after document will be downloaded and loaded in the view. |
| load |
(stream:Stream) : true/false
Method loads new document (replaces current one) in the current view from the given in-memory stream. |
| box |
( part [, edge [, relativeTo ]] ) returns: integer, device pixels
Returns coordinates of the edges of the view. Parameters:
|
| move |
( x:int, y:int [, clientCoordinates: true | false] ) :void
Replaces window of the view (dialog or frame) on the screen. This method is applicable only for standalone Sciter. If clientCoordinates is true x and y are interpretted as a desired position of the client area on the screen. |
| move |
( x:int, y:int, width:int, height:int [, clientCoordinates: true | false] ) :void
Replaces window and changes dimension of the view (dialog or frame) on the screen. This method is applicable only for standalone Sciter. If clientCoordinates is true x,y, width and height are interpretted as a desired position/size of the client area on the screen. |
| selectFile |
( #save | #load, filter:string , ext: string ) : string | null
Methods shows system file selector modal dialog and returns full path name of the selected file or null if user cancels this dialog.
Following sample will popup dialog to select html files and will load file in current view:
var fn = view.selectFile(#open,
"HTML Files (*.htm,*.html)|*.HTM;*.HTML|All Files (*.*)|*.*" , "html" );
if( fn ) view.load(fn);
|
| selectPrinter | TBD |
| dialog |
( url: string | stream: Stream [, parameters: any [, position: int = 5] ] ) : undefined | value passed to close method.
Shows modal dialog defined by document at url or contained in in-memory stream. object parameters if given will be copied to view.parameters variable available for scripts inside dialog HTML. position is an integer in range [1..9], it defines position of the dialog window relative to the parent view window. For meaning of the values see NUMPAD on the keyboard, e.g. position 5 means center/middle of the dialog will be placed in the center/middle of the view. |
| msgbox |
( type:symbol, text: string, [ title: string, [ buttons [, onLoad: function [, onClose: function ]]]] ) : undefined | symbol of the button pressed to close dialog.
Samples:
|
| close |
( [retval: any] ) : undefined
closes current view (or dialog if it is view of dialog window). retval is any scripting object - return value of the dialog() function. |
| doEvent |
( [#wait | #nowait | #all] ) : undefined
Passes control to the operating system. Control is returned after the operating system has finished processing next event in its event queue. This method is used for implementing modal document loops. In case of:
|
| update |
() : undefined
Executes all pending changes in the view and renders what was changed on the screen. After this call box coordinates of all DOM elements are valid. Use this method when you need to commit all updates made on the DOM to the moment. For example: function retrieveDataFromDB(recordSet)
{
while(!recordSet.EOF())
{
grid.appendRow(recordSet.row);
if(++numRowsAdded > 10)
{
numRowsAdded = 0;
view.update();
}
}
}
|
| clipboard |
(callback: function) : undefined
Calls the callback function for each format of data presented in system clipboard at the moment. The callback function has following signature:
|
| clipboard |
(#get, dataType: symbol) : string | object | Image;
Fetches data from the clipboard in format defined by the dataType parameter. For list of allowed values see previous method definition. Note: for the #html format this function returns two values: source url (if any) and html data per se. |
| clipboard |
(#put, data: string | object | Image ) : undefined;
Stores data to the clipboard. |
| view.onSize() : void | This function is invoked by the engine after dimensions of the view (window) was changed. Use view.box() method to get dimensions. |
| view.onMove() : void | Invoked by the engine after position of the view (window) was changed. Use view.box() method to get dimensions and positions. |
| view.onStateChanged() : void |
Invoked when state of the view (window) was changed. See View.state property. |
| view.activated(mode): void | The event is generated when Sciter window gets activated or deactivated. mode here takes the following values:
|