中文|英語
クロスプラットフォームGolang Guiライブラリ、コアバインディングはLiblCLです。これは、Lazarusが作成した一般的なクロスプラットフォームGUIライブラリです。
GOVCLは、HTMLに基づいていないネイティブGUIライブラリであり、DirectUIライブラリは言うまでもなく、すべてが実用的です。
フルネーム: Go Language Visual Component Library
GOVCLの最小要件はgo1.9.2です。
GovCLはすでに安定した段階に入っており、現在純粋なメンテナンスの状態にあるためです。通常の状況では、新しい機能やコンポーネントは追加されません。修正する必要があるバグがない場合(GOVCLのバグを参照)、原則として、新しいバージョンはリリースされません。 2023/11/20
スクリーンショット| wiki(中国)|何が新しい(中国語)
Windows | Linux | macos
Linux ArmとLinux 32bitをサポートする場合は、対応するLiblCLバイナリをコンパイルする必要があります。
注:このUIデザイナーは更新されなくなりましたが、使用には影響しません。
使用方法:インストール方法
注:ゴランで書かれたコード、ラザロで設計されています。
Get -U Github.com/ying32/govcl
注:goモジュールモードを使用することもできますgithub.com/ying32/govcl v2.2.3+incompatibleなど、go.modで構成することもできます。
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!" )
}方法1は、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:コンパイルされたバイナリが32ビットまたは64ビットのかどうかに応じて、対応するliblcl.dllを現在の実行可能ファイルディレクトリまたはシステム環境パスにコピーします。
GOARCH = amd64 386 GOOS = windows CGO_ENABLED=0 Linux: liblcl.soを現在の実行可能ファイルディレクトリの下にコピーします(公共図書館として使用されるliblcl.so liblcl)または/usr/lib/ /usr/lib/x86_64-linux-gnu/ (64bit liblcl)ディレクトリにコピーすることもできます)。
GOARCH = amd64 GOOS = linux CGO_ENABLED=1 macos: liblcl.dylibを現在の実行可能ファイルディレクトリにコピーします(macosの下に注:info.plistファイルを自分で作成する必要があります)、またはmacosのアプリパッケージを参照してください
GOARCH = amd64 GOOS = darwin CGO_ENABLED=1注:「現在の実行可能ファイルディレクトリ」は、現在コンパイルされているプロジェクトによって生成された実行可能ファイルの場所を指します。
特別な注意:すべてのUIコンポーネントは、非スレッド/非コーチンセーフです。 Goroutineで使用する場合は、vcl.threadsyncを使用してUIの更新を同期させます。
Special Note 2:go> = 1.15を使用してWindows実行可能ファイルをコンパイルする場合、 -buildmode=exeコンパイルオプションを使用する必要があります。そうしないと、エラーが発生します。
Q:なぜ英語のwikiがないのですか?
A:私の英語は悪いです。 Google Translate Chinese Wikiを使用してみてください。