在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:ying32/govcl开源软件地址:https://github.com/ying32/govcl开源编程语言:Go 100.0%开源软件介绍:中文 | English GoVCLCross-platform Golang GUI library, The core binding is liblcl, a common cross-platform GUI library created by Lazarus. GoVCL is a native GUI library, not based on HTML, let alone DirectUI library, everything is practical. Full name: govcl minimum requirement is go1.9.2. Screenshots | WIKI(Chinese) | What's-new(Chinese) | Video tutorial(Unofficial) | Sponsor govcl Support PlatformWindows | Linux | macOS
source code)Pre-compiled GUI library binary download (source code)res2go IDE plugin source code(How to use: Installation method
usage:Step 1: Get the govcl code
Note: You can also use go module mode, configure in go.mod, such as: Step 2: Write the code
package main
import (
// Do not reference this package if you use custom syso files
_ "github.com/ying32/govcl/pkgs/winappres"
"github.com/ying32/govcl/vcl"
)
type TMainForm struct {
*vcl.TForm
Btn1 *vcl.TButton
}
type TAboutForm struct {
*vcl.TForm
Btn1 *vcl.TButton
}
var (
mainForm *TMainForm
aboutForm *TAboutForm
)
func main() {
vcl.Application.Initialize()
vcl.Application.SetMainFormOnTaskBar(true)
vcl.Application.CreateForm(&mainForm)
vcl.Application.CreateForm(&aboutForm)
vcl.Application.Run()
}
// -- TMainForm
func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
}
func (f *TMainForm) OnBtn1Click(sender vcl.IObject) {
aboutForm.Show()
}
// -- TAboutForm
func (f *TAboutForm) OnFormCreate(sender vcl.IObject) {
}
func (f *TAboutForm) OnBtn1Click(sender vcl.IObject) {
vcl.ShowMessage("Hello!")
} Method 1 needs to be used in conjunction with the res2go tool.
package main
import (
// Do not reference this package if you use custom syso files
_ "github.com/ying32/govcl/pkgs/winappres"
"github.com/ying32/govcl/vcl"
)
type TMainForm struct {
*vcl.TForm
Btn1 *vcl.TButton
}
type TAboutForm struct {
*vcl.TForm
Btn1 *vcl.TButton
}
var (
mainForm *TMainForm
aboutForm *TAboutForm
)
func main() {
vcl.RunApp(&mainForm, &aboutForm)
}
// -- TMainForm
func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
f.SetCaption("MainForm")
f.Btn1 = vcl.NewButton(f)
f.Btn1.SetParent(f)
f.Btn1.SetBounds(10, 10, 88, 28)
f.Btn1.SetCaption("Button1")
f.Btn1.SetOnClick(f.OnBtn1Click)
}
func (f *TMainForm) OnBtn1Click(sender vcl.IObject) {
aboutForm.Show()
}
// -- TAboutForm
func (f *TAboutForm) OnFormCreate(sender vcl.IObject) {
f.SetCaption("About")
f.Btn1 = vcl.NewButton(f)
//f.Btn1.SetName("Btn1")
f.Btn1.SetParent(f)
f.Btn1.SetBounds(10, 10, 88, 28)
f.Btn1.SetCaption("Button1")
f.Btn1.SetOnClick(f.OnBtn1Click)
}
func (f *TAboutForm) OnBtn1Click(sender vcl.IObject) {
vcl.ShowMessage("Hello!")
} Step 3: Copy the corresponding binary
Note: The "current executable file directory" here refers to the location of the executable file generated by your currently compiled project. Special Note: All UI components are non-threaded/non-coroutine safe. When used in goroutine, use vcl.ThreadSync to synchronize updates to the UI. Special Note 2: If you use go>=1.15 to compile Windows executable files, you must use the FAQQ: Why is there no English WIKI? API document |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论