Represents window where this script is runnung.
view - current view object (of the running script) is accessible through gloabal view variable.
| Constants | |
| WINDOW_SHOWN | Values of view.state property. |
| WINDOW_MINIMIZED | |
| WINDOW_MAXIMIZED | |
| WINDOW_HIDDEN | |
| 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:
|
| 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 [, width:int, height:int] ) :void
Replaces window of the view (dialog or frame) on the screen. This method is applicable only for standalone Sciter. |
| 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 [, onClose: function [, onLoad: 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
Exacutes 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: |
| 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.onLoad() : void | This event is raised after DOM is complete and all scripts were executed. At the moment of this event all elements that have prototype objects assigned. |
| view.onUnload() : true | false |
This event is raised before the view will get a new document. E.g. view.load() will cause this method be invoked. Return false from this method to reject unloading of the current document. Code of this method is the best place to close all opened resources like storages, etc. |