Beispiel #1
0
func main() {
	flag.Parse()
	if len(flag.Args()) < 1 {
		log.Fatal("no html file found")
	}
	// create window
	w, err := window.New(sciter.DefaultWindowCreateFlag, sciter.DefaultRect)
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("Sciter Version: %X %X\n", sciter.Version(true), sciter.Version(false))
	// resource packing
	rice.HandleDataLoad(w.Sciter)
	// enable debug
	ok := w.SetOption(sciter.SCITER_SET_DEBUG_MODE, 1)
	if !ok {
		log.Println("set debug mode failed")
	}
	// load file
	if err = w.LoadFile(flag.Arg(0)); err != nil {
		log.Println("LoadFile error:", err.Error())
		return
	}
	root, err := w.GetRootElement()
	if err != nil {
		log.Fatalf("get root element failed: %s", err.Error())
	}
	setElementHandlers(root)
	// set handlers
	setEventHandler(w)
	setCallbackHandlers(w)
	testCall(w)
	w.Show()
	w.Run()
}
Beispiel #2
0
func main() {
	w, err := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE|sciter.SW_CONTROLS|sciter.SW_MAIN|sciter.SW_ENABLE_DEBUG, nil)
	if err != nil {
		log.Fatal(err)
	}
	// log.Printf("handle: %v", w.Handle)
	// w.LoadFile("simple.html")
	w.LoadHtml("<html>asdf</html>", "")
	w.SetTitle("Inserting Example")
	root, err := w.GetRootElement()
	if err != nil {
		log.Panicln(err)
	}
	div, err := sciter.CreateElement("div", "hello world")
	if err != nil {
		log.Printf("sciter.CreateElement('div', '') %s", err.Error())
		return
	}
	err = root.Insert(div, 0)
	if err != nil {
		log.Printf("root.Insert(div, 0) %s", err.Error())
		return
	}
	w.Show()
	w.Run()
}
Beispiel #3
0
func main() {
	w, err := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE|sciter.SW_CONTROLS|sciter.SW_MAIN|sciter.SW_ENABLE_DEBUG, nil)
	if err != nil {
		log.Fatal("Create Window Error: ", err)
	}
	w.LoadFile("index.html")
	setEventHandler(w)
	w.Show()
	w.Run()
}
Beispiel #4
0
func main() {
	w, err := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE|sciter.SW_CONTROLS|sciter.SW_MAIN|sciter.SW_ENABLE_DEBUG, nil)
	if err != nil {
		log.Fatal(err)
	}
	// log.Printf("handle: %v", w.Handle)
	w.LoadFile("simple.html")
	w.SetTitle("Example")
	w.Show()
	w.Run()
}
Beispiel #5
0
func main() {
	flag.Parse()
	if flag.NArg() < 1 {
		log.Fatal("html file needed")
	}
	rect := sciter.NewRect(300, 300, 300, 400)
	// create window
	w, err := window.New(sciter.DefaultWindowCreaetFlag, rect)
	if err != nil {
		log.Fatal(err)
	}

	w.LoadFile(flag.Arg(0))
	w.Show()
	w.Run()
}
Beispiel #6
0
func main() {
	log.Println("Sciter Version:", sciter.VersionAsString())
	flag.Parse()
	if flag.NArg() == 0 {
		log.Fatalln("at least one Sciter compatible page url is needed")
	}
	log.Println(flag.Arg(0))
	w, err := window.New(sciter.SW_ENABLE_DEBUG|sciter.SW_GLASSY, sciter.DefaultRect)
	if err != nil {
		log.Fatal(err)
	}

	w.SetTitle("Download Element Content")
	w.LoadHtml("<html><body><span id='url'>Url To Load</span><frame id='content'></frame></body></html>", "/")
	test()
	load(w, flag.Arg(0))
	w.Show()
	w.Run()
}
Beispiel #7
0
func main() {
	w, err := window.New(sciter.DefaultWindowCreateFlag, sciter.DefaultRect)
	if err != nil {
		log.Fatal("sciter create window failed", err)
	}

	w.SetTitle("test for element.Text and element.Html")
	w.LoadHtml(html, "")

	root, err := w.GetRootElement()
	if err != nil {
		log.Fatal(err)
	}
	text, err := root.Text()
	if err != nil {
		log.Fatal(err)
	}
	log.Println("text:", text)
	text, err = root.Html(false)
	if err != nil {
		log.Fatal(err)
	}
	log.Println("html:", text)
}