Note: linux and macOS only part of the components, properties, events and methods are valid
Librarys binaries
Note: The attachment contains liblcl three platform binary, libvcl does not currently provide, you need to compile. For the compilation steps, please refer to the instructions in UILIbSrcources
res2go Tool
Note: Designed in Delphi/Lazarus, code written in Golang.
go get github.com/ying32/govcl
- Method 1:
package main
import (
"github.com/ying32/govcl/vcl"
)
var (
mainForm *vcl.TForm
)
func main() {
vcl.Application.Initialize()
mainForm = vcl.Application.CreateForm()
mainForm.SetCaption("Hello")
mainForm.EnabledMaximize(false)
mainForm.ScreenCenter()
vcl.Application.Run()
}
- Method 2:
package main
import (
"github.com/ying32/govcl/vcl"
)
type TMainForm struct {
*vcl.TForm
Btn1 *vcl.TButton
}
var (
mainForm *TMainForm
)
func main() {
vcl.Application.Initialize()
vcl.Application.SetMainFormOnTaskBar(true)
vcl.Application.CreateForm(&mainForm)
vcl.Application.Run()
}
func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
f.SetCaption("Hello")
f.Btn1 = vcl.NewButton(f)
f.Btn1.SetParent(f)
f.Btn1.SetBounds(10, 10, 88, 28)
f.Btn1.SetCaption("Button1")
f.Btn1.SetOnClick(f.OnButtonClick)
}
func (f *TMainForm) OnButtonClick(sender vcl.IObject) {
vcl.ShowMessage("Hello!")
}
- Method 3:
package main
import (
"github.com/ying32/govcl/vcl"
)
type TMainForm struct {
*vcl.TForm
Btn1 *vcl.TButton
}
var (
mainForm *TMainForm
)
func main() {
vcl.Application.Initialize()
vcl.Application.SetMainFormOnTaskBar(true)
vcl.Application.CreateForm(mainFormBytes, &mainForm)
vcl.Application.Run()
}
func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
}
func (f *TMainForm) OnBtn1Click(sender vcl.IObject) {
vcl.ShowMessage("Hello!")
}
Method 3 needs to be used in conjunction with the UI designer or the res2go tool.
Q: Why is there no English WIKI?
A: My English is bad. You can try using Google Translate Chinese WIKI.
When using the "liblcl" library, it is run in a compatible "libvcl" library, so some methods and properties of components and components are not available.
-
Windows: Copy "libvcl.dll" or "libvclx64.dll" or "liblcl.dll" to the current exe directory or system environment path.
-
Linux: Copy the "liblcl.so" executable directory (you can also copy liblcl.so to the
/usr/lib/
directory and use it as a public library). -
MacOS: Copy the "liblcl.dylib" executable directory (Note for MacOS: you need to create the info.plist file yourself), or refer to: App packaging on MacOS