• Stars
    star
    2,098
  • Rank 22,008 (Top 0.5 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Cross-platform Go/Golang GUI library.

中文 | English

GoVCL

Cross-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: Go Language Visual Component Library

govcl minimum requirement is go1.9.2.


Because GoVCL has already entered a stable stage and is currently in a state of pure maintenance. Under normal circumstances, no new features or components will be added. If there are no bugs that need to be fixed (referring to the bugs in govcl), in principle, a new version will not be released. 2023/11/20


Screenshots | WIKI(Chinese) | What's-new(Chinese)


Ⅰ. Support Platform

Windows | Linux | macOS

If you want to support linux arm and linux 32bit, you need to compile the corresponding liblcl binary.

Ⅱ. Pre-compiled GUI library binary download (source code)

liblcl

Ⅲ. UI Designer(Two options)

  • 1、 Easy UI designer (single-page design, suitable for those who do not want to install Lazarus, and the project is not too complicated)

GoVCLDesigner.win

Note: This UI designer is no longer updated, but it does not affect use.

How to use: Installation method

Note: Designed in Lazarus, code written in Golang.

Ⅳ. usage:

Step 1: Get the govcl code

go get -u github.com/ying32/govcl

Note: You can also use go module mode, configure in go.mod, such as: github.com/ying32/govcl v2.2.3+incompatible.

Step 2: Write the code

  • Method 1(Use Lazarus to design the GUI. recommend):
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.

  • Method 2(Pure code, imitating the way of FreePascal class):
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

  • Windows: Depending on whether the compiled binary is 32 or 64 bits, copy the corresponding liblcl.dll to the current executable file directory or system environment path.

    • Go environment variable: GOARCH = amd64 386 GOOS = windows CGO_ENABLED=0
  • Linux: Copy liblcl.so under the current executable file directory (you can also copy liblcl.so to /usr/lib/ (32bit liblcl) or /usr/lib/x86_64-linux-gnu/ (64bit liblcl) directory , Used as a public library).

    • Go environment variable: GOARCH = amd64 GOOS = linux CGO_ENABLED=1
  • MacOS: Copy liblcl.dylib to the current executable file directory (note under MacOS: you need to create info.plist file yourself), or refer to: App packaging on MacOS

    • Go environment variable: GOARCH = amd64 GOOS = darwin CGO_ENABLED=1

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 -buildmode=exe compilation option, otherwise there will be errors.


Ⅴ. FAQ

Q: Why is there no English WIKI?
A: My English is bad. You can try using Google Translate Chinese WIKI.


Ⅵ. API document

More Repositories

1

duilib-for-Delphi

DDuilib是一个建立在C++开源项目duilib之上,且最大限度不去修改duilib源代码从而可以应用在Delphi或者FreePascal中构建Direcut UI的开源项目(作者已弃坑)。
Pascal
147
star
2

rproxy

简单的反向代理用于内网穿透,支持HTTP/HTTPS转发
Go
128
star
3

liblcl

A common cross-platform GUI library, the core uses Lazarus LCL.
Pascal
121
star
4

htmlparser

delphi html parser(代码是改自原wr960204的HtmlParser)
Pascal
69
star
5

dylib

Universal cross-platform dynamic link library call, support dll, so, dylib. Move from: github.com/ying32/govcl/vcl/dylib
Go
42
star
6

readability

readability for golang. 网页文章标题和正文抽取工具
Go
32
star
7

nim-vcl

cross-platform nim GUI
Nim
31
star
8

res2go-ide-plugin

res2go Lazarus IDE plug-in
Pascal
30
star
9

xldl

迅雷下载引擎SDK Go语言版
Go
27
star
10

JavaClassToDelphiUnit

解析JavaClass文件生成Delphi开发Android单元
Pascal
19
star
11

rust-vcl

cross-platform rust GUI
Rust
13
star
12

delphi-javascript

Automatically exported from code.google.com/p/delphi-javascript
Pascal
8
star
13

FMXWndProcHook

FMX下TForm的WndProc HOOK
Pascal
8
star
14

qqwry

纯真ip数据库查询
Go
7
star
15

alidayu

阿里大于最新sdk 2017-05-25
Go
7
star
16

ying32.github.io

Official website of GoVCL
Go
5
star
17

jxmarshal

json and xml Marshal/UnMarshal
Pascal
5
star
18

liblclbinres

此仓库只是用来存储golang的liblcl二进制包(This repository is only used to store golang liblcl binary package)
Go
5
star
19

xl7

xl7 sdk for Go, 迅雷7 Go语言SDK。这个版本的官方Demo都有问题,没具体研究过问题出在何处,推荐用老版本的SDK
Go
5
star
20

RTXCPluginForDelphiSDK

导入自:https://gitee.com/ying32/RTXCPluginForDelphiSDK
Pascal
4
star
21

IpoptPasHeader

Ipopt Pascal头文件
Pascal
3
star
22

babel

jsx编译和压缩
Go
3
star
23

YingBlog

自己的一个博客站点,学习golang的第二个作品
Go
2
star
24

sdnsserver

simple dns server
Go
2
star
25

dcef3

Automatically exported from code.google.com/p/dcef3
Pascal
2
star