Open taonylu opened 6 years ago
Basic principles are described in this article about native behaviors in Sciter. Also there is an article in Sciter's Help browser, check its last section called "Custom Components".
The list of standard behaviors: https://sciter.com/developers/sciter-docs/native-behaviors/
Basically you can create custom behavior either in script or in native side by attaching an own handler to particular existing or created html element. This handler is called for each created element (see Element.attached
function in script or sciter::event_handler::attached
in C++ or sciter.EventHandler.OnAttached
in Go), so you can subscribe to its events, create additional HTML elements inside it and do whatever you want.
Custom behaviors usually created in script because it is much easier to do. There are a lot of examples in sciter samples (see custom-inputs, graphics, ideas folders). As for native behaviors, they are used to interact with OS services like USB camera, native components and drawing (native child windows, opengl/directx panels, video and so on).
So, I am not sure what kind of native behavior you would like to have in Go. It is easy to make, but I have no idea, what it should do.
Thank you for your answer. I am going to add an embed webbrowser, such as miniblink( you could find it in github). In past, when I use htmllayout, I can create a static or custom control to attach an custom behavior, to load html page. Thank you for your help. I'll try this OnAttached callback. I am new to this go-sciter sdk.
^.~
Native API in Sciter was not so changed since HTMLayout, so it wouldn't be a problem. Web browser is basically a child window, the first article I mentioned explains it well.
Basic principles are described in this article about native behaviors in Sciter. Also there is an article in Sciter's Help browser, check its last section called "Custom Components".
The list of standard behaviors: https://sciter.com/developers/sciter-docs/native-behaviors/
Basically you can create custom behavior either in script or in native side by attaching an own handler to particular existing or created html element. This handler is called for each created element (see
Element.attached
function in script orsciter::event_handler::attached
in C++ orsciter.EventHandler.OnAttached
in Go), so you can subscribe to its events, create additional HTML elements inside it and do whatever you want.Custom behaviors usually created in script because it is much easier to do. There are a lot of examples in sciter samples (see custom-inputs, graphics, ideas folders). As for native behaviors, they are used to interact with OS services like USB camera, native components and drawing (native child windows, opengl/directx panels, video and so on).
So, I am not sure what kind of native behavior you would like to have in Go. It is easy to make, but I have no idea, what it should do.
Would you show an example of USB camera?
Thank you for your answer. I've already road those articles. But this is in Golang, the behavior was not found an example in this porting. I've tried some methods, only get one not good method: Find the element, then do event binding and editting attributes. I am still finding such behavior example like C lang. To embed an webbrowser in application.
Kindly regards, Taony
I'm sorry for ask an example. I don't know how to make an custom behavior in go lang. If you could give an simple example, I would be very happy. Thank you.