sciter-sdk / go-sciter

Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
https://sciter.com
2.57k stars 269 forks source link

example regarding mouse/key event needed ( in a non-tiscript way ) #174

Open coolit opened 5 years ago

coolit commented 5 years ago

Most codes about mouse/key event are written in tiscript. So it would be nice to have an example in pure golang code.

pravic commented 5 years ago

Perhaps.

In general, SDK examples are quite understandable, also you can take a look on HTMLayout (it didn't include TIScript, so its examples were in pure C++).

Essentially, you ~need to subscribe~ (you don't — Go uses HANDLE_ALL at the moment) on HANDLE_MOUSE and HANDLE_KEY during subscription request, and then process HANDLE_MOUSE and HANDLE_KEY via handler.OnMouse, handler.OnKey respectively.

Use Element.AttachEventHandler to subscribe to the DOM element events.