Skip to content

Commit cd3da42

Browse files
committed
+ Added info about event handler
1 parent 3d6cd6a commit cd3da42

2 files changed

Lines changed: 80 additions & 2 deletions

File tree

docs/eventhandlers.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,30 @@ Occurs when a JavaScript xcall(...) call on a element or window.
2929

3030
### MethodCall
3131

32+
Occurs when some of standart element methods called.
33+
3234
### ExchangeParameters
3335

3436
### DataArrived
3537

3638
### DrawEvent
3739

40+
In this event handler you can write custom logic for drawing.
41+
3842
### GestureEvent
3943

44+
Occurs when some of gesture happened.
45+
4046
### SizeEvent
4147

48+
Occurs after size of element changed.
49+
4250
### TimerEvent
4351

4452
### ScrollEvent
4553

54+
Occurs after scrolling.
55+
4656
### FocusEvent
4757

4858
### KeyboardEvent
@@ -79,4 +89,35 @@ public class MyWindowEventHandler : WindowEventHandler {
7989

8090
## Add EventHandler for element from CSS property
8191

92+
First you need to add a factory to create you custom `SciterEventHandler`:
93+
94+
```csharp
95+
host.Callbacks.AddAttachBehaviourFactory ( "mybehaviour", ( element ) => new MyCustomEventHandler ( element, host ) );
96+
```
97+
98+
After it you can attach registered custom SciterEventHandler in CSS class or tag style:
99+
```css
100+
// in CSS
101+
102+
.customClass {
103+
behavior: 'mybehaviour'
104+
}
105+
106+
<div class="customClass">
107+
</div>
108+
```
109+
110+
```html
111+
<div style="behavior: 'mybehaviour'">
112+
</div>
113+
```
114+
82115
## Add EventHandler for element via SciterAPI
116+
117+
```csharp
118+
// create event handler
119+
var eventHandler = new SciterEventHandler();
120+
121+
// attach eventHandler with element
122+
host.AddEventHandler(eventHandler);
123+
```

docs/loadingandrun.md

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1-
## Load HTML and show window
1+
## Load HTML page
2+
3+
You can load HTML page by default from local file `file://...` or from internet `http(s)://...`.
4+
Also supported local (from application path) folder via `home://...` protocol.
5+
For loading HTML page you need to call method `SciterApiHost.LoadFile(...)`.
6+
7+
```csharp
8+
host.LoadFile ( "file://my/path/to/file/index.html" );
9+
```
10+
11+
You can also implement your own file source via the Custom File protocol. For more information check out [page](fileprotocols.md).
12+
13+
## Run Sciter loop
14+
15+
Main Sciter loop start handle events and show main window. Loop will be happened until if last opened window will be closed by user or programmatically.
16+
Start loop look like this:
17+
18+
```csharp
19+
var code = host.Process ();
20+
if (code != 0) {
21+
// error handling logic
22+
}
23+
```
24+
25+
You can close the main window while the loop is running as follows:
26+
```csharp
27+
host.CloseMainWindow();
28+
```
29+
After this, all other open windows will also be closed.
30+
31+
To close any other non-main window, you can call another method:
32+
```csharp
33+
host.CloseWindow(windowHwnd); // windowHwnd is pointer on window
34+
```
35+
36+
37+
38+
39+
240

3-
in progress

0 commit comments

Comments
 (0)