Example #1
0
File: rot13.go Project: DaviWei/iup
func onRotate(ih *iup.Ihandle) int {
	content := iup.GetAttribute(text, "VALUE")
	content = rot13(content)
	iup.StoreAttribute(text, "VALUE", string(content))

	return iup.DEFAULT
}
Example #2
0
File: rot13.go Project: DaviWei/iup
func onLoadFile(ih *iup.Ihandle) int {
	dlg := iup.FileDlg("ALLOWNEW=NO,DIALOGTYPE=Open,TITLE=Open")
	iup.SetAttributeHandle(dlg, "PARENTDIALOG", mainDlg)
	iup.Popup(dlg, iup.CENTER, iup.CENTER)
	if iup.GetInt(dlg, "STATUS") == -1 {
		return iup.IGNORE
	}

	filename := iup.GetAttribute(dlg, "VALUE")
	iup.Destroy(dlg)

	content, err := ioutil.ReadFile(filename)
	if err != nil {
		iup.Message("Error", fmt.Sprintf("Error: %s", err))
		return iup.IGNORE
	}

	iup.StoreAttribute(text, "VALUE", string(content))

	return iup.IGNORE
}
Example #3
0
func sayHelloToSomeone(ih *iup.Ihandle) int {
	fmt.Printf("Hello, %s!\n", iup.GetAttribute(someone, "VALUE"))
	return 0
}
Example #4
0
func sayHello(ih *iup.Ihandle) int {
	fmt.Printf("Hello, %s!\n", iup.GetAttribute(ih, "TO_WHO"))
	return 0
}
Example #5
0
func onGo(ih *iup.Ihandle) int {
	iup.StoreAttribute(browser, "VALUE", iup.GetAttribute(urlentry, "VALUE"))

	return iup.DEFAULT
}