Home > other >  Go the best GUI library at https://github.com/ying32/govcl
Go the best GUI library at https://github.com/ying32/govcl

Time:12-25

The address of the project:
https://github.com/ying32/govcl

Next door to use Delphi similar VCL, open source stability without the copyright problem,

 
Package the main


Import (
//if you use a custom syso files don't refer to this package
_ "github.com/ying32/govcl/pkgs/winappres
""Github.com/ying32/govcl/vcl
")

Type TMainForm struct {
* the VCL TForm
Btn1 * VCL TButton
}

Type TAboutForm struct {
* the VCL TForm
Btn1 * VCL TButton
}

Var (
MainForm * TMainForm
AboutForm * TAboutForm
)

Func main () {
The VCL. RunApp (& amp; MainForm, & amp; AboutForm)
}

//- TMainForm

Func (f * TMainForm) OnFormCreate (sender VCL. IObject) {
F.S etCaption (" MainForm ")

F.B tn1=VCL. NewButton (f)
F.B tn1. SetParent (f)
F.B tn1. SetBounds (10, 10, 88, 28)
F.B tn1. SetCaption (" for ")
F.B tn1. SetOnClick (f.O nBtn1Click)
}

Func (f * TMainForm) OnBtn1Click (sender VCL. IObject) {
AboutForm. The Show ()
}


//- TAboutForm

Func (f * TAboutForm) OnFormCreate (sender VCL. IObject) {
F.S etCaption (" About ")
F.B tn1=VCL. NewButton (f)
//f.B tn1. Elegantly-named SetName (" Btn1 ")
F.B tn1. SetParent (f)
F.B tn1. SetBounds (10, 10, 88, 28)
F.B tn1. SetCaption (" for ")
F.B tn1. SetOnClick (f.O nBtn1Click)
}

Func (f * TAboutForm) OnBtn1Click (sender VCL. IObject) {
The VCL. ShowMessage (" Hello!" )
}


  • Related