For a detailed document of the View object, see:
Https://sciter.com/docs/content/sciter/View.htm
The demo9.html code is as follows:
<! DOCTYPE html>The
Demo9.go code is as follows:
Package Main;import ("Github.com/sciter-sdk/go-sciter/window" "Github.com/sciter-sdk/go-sciter" "Log" "OS" "Strings" "Path/filepath" "Io/ioutil" "FMT") Func Deffunc (w *window. Window) {//Register dump function for easy printing of data w in tis script. Definefunction ("Dump", func (args ... *sciter). Value) *sciter. Value {for _, V: = Range args {fmt. Print (v.string () + "");} Fmt. Println (); return sciter. Nullvalue ();}); /process file Move W. Definefunction ("MoveFile", func (args ... *sciter). Value) *sciter. Value {file: = Args[0]. String (); folder: = Args[1]. String ();//Remove the File://file = strings to the left of the path. Trimleft (file, "file://");//Get file name filename: = filepath. Base (file);//Read the data of files, err: = Ioutil. ReadFile (file); if err! = Nil {return sciter. NewValue (Err. Error ());} Write file Data err = Ioutil. WriteFile (filepath. Join (folder, fileName), data, OS. Modeperm); If err = = Nil {//delete original file OS. Remove (file); return sciter. NewValue ("mobile Success");} else {return sciter. NewValue ("Move Failed");}}); Func Main () {W, Err: = window. New (Sciter. Defaultwindowcreateflag, Sciter. Defaultrect); if err! = Nil {log. Fatal (err);} W. LoadFile ("demo9.html"); W.settitle ("View Object Learning");d Effunc (w); W.show (); W.run ();}
The results appear as follows:
Go language use Go-sciter to create desktop Apps (vii) View object common methods, file selection, window popup, request