中文 | Anglais
Bibliothèque Golang GUI multiplateforme, la liaison centrale est Liblcl, une bibliothèque GUI multiplateforme commune créée par Lazarus.
GoVCL est une bibliothèque GUI native, pas basée sur HTML, sans parler de la bibliothèque Diretui, tout est pratique.
Nom complet: Go Language Visual Component Library
GOVCL Minimum Exigence est Go1.9.2.
Parce que GoVCL est déjà entré dans une étape stable et est actuellement dans un état de maintenance pure. Dans des circonstances normales, aucune nouvelle fonctionnalité ou composant ne sera ajoutée. S'il n'y a pas de bogues qui doivent être corrigées (se référant aux bogues dans GoVCL), en principe, une nouvelle version ne sera pas publiée. 2023/11/20
Captures d'écran | Wiki (chinois) | Qu'est-ce que nous ne neuf (chinois)
Windows | Linux | macos
Si vous souhaitez prendre en charge Linux ARM et Linux 32 bits, vous devez compiler le binaire LiblCl correspondant.
Remarque: Ce concepteur d'interface utilisateur n'est plus mis à jour, mais il n'affecte pas l'utilisation.
Comment utiliser: Méthode d'installation
Remarque: Conçu à Lazarus, code écrit en Golang.
Allez get -u github.com/yying32/govcl
Remarque: Vous pouvez également utiliser le mode module Go, configurer dans go.mod, tel que: github.com/ying32/govcl v2.2.3+incompatible .
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!" )
}La méthode 1 doit être utilisée en conjonction avec l'outil RES2GO.
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!" )
} Windows: selon que le binaire compilé est de 32 ou 64 bits, copiez le liblcl.dll correspondant au répertoire de fichiers exécutable actuel ou à un chemin d'environnement système.
GOARCH = amd64 386 GOOS = windows CGO_ENABLED=0 Linux: copier liblcl.so dans le répertoire de fichiers exécutables actuel (vous pouvez également copier liblcl.so sur /usr/lib/ (32bit liblcl) ou /usr/lib/x86_64-linux-gnu/ (64bit liblcl), utilisé comme bibliothèque publique).
GOARCH = amd64 GOOS = linux CGO_ENABLED=1 MacOS: copier liblcl.dylib dans le répertoire de fichiers exécutable actuel (note sous macOS: vous devez créer vous-même des informations.plist), ou consultez: emballage de l'application sur macOS
GOARCH = amd64 GOOS = darwin CGO_ENABLED=1Remarque: Le "répertoire de fichier exécutable actuel" fait ici référence ici à l'emplacement du fichier exécutable généré par votre projet actuellement compilé.
Remarque spéciale: Tous les composants de l'interface utilisateur sont sûrs non threaded / non-cooutine. Lorsqu'il est utilisé dans Goroutine, utilisez VCL.ThreadSync pour synchroniser les mises à jour de l'interface utilisateur.
Remarque spéciale 2: Si vous utilisez Go> = 1.15 pour compiler les fichiers exécutables Windows, vous devez utiliser l'option de compilation -buildmode=exe , sinon il y aura des erreurs.
Q: Pourquoi n'y a-t-il pas de wiki anglais?
R: Mon anglais est mauvais. Vous pouvez essayer d'utiliser Google Translate Wiki chinois.