您尚未登录。

楼主 #1 2021-04-02 09:45:55

lixianjing
会员
注册时间: 2019-04-25
已发帖子: 103
积分: 99.5

AWTK Go 语言绑定来了,欢迎使用

AWTK Go 语言绑定来了,欢迎使用:https://github.com/zlgopen/awtk-go

import (
	"fmt"

	"github.com/zlgopen/awtk-go/awtk"
)

func onCancel(ctx interface{}, e awtk.TEvent) awtk.TRet {
	fmt.Println("Cancel is clicked")
	return awtk.RET_OK
}

func appInit() {
	win := awtk.TWindowCreateDefault()

	ok := awtk.TButtonCreate(win, 10, 10, 80, 30)
	ok.SetPropStr(awtk.WIDGET_PROP_TEXT, "OK")
	ok.SetSelfLayout("default(x=c,y=m,w=80,h=40)")
	ok.On(awtk.EVT_CLICK, func(ctx interface{}, e awtk.TEvent) awtk.TRet {
		fmt.Println("OK is clicked")
		return awtk.RET_OK
	}, win)

	cancel := awtk.TButtonCreate(win, 10, 10, 80, 30)
	cancel.SetPropStr(awtk.WIDGET_PROP_TEXT, "Cancel")
	cancel.SetSelfLayout("default(x=c,y=m:-60,w=80,h=40)")
	cancel.On(awtk.EVT_CLICK, onCancel, win)

	quit := awtk.TButtonCreate(win, 10, 10, 80, 30)
	quit.SetPropStr(awtk.WIDGET_PROP_TEXT, "Quit")
	quit.SetSelfLayout("default(x=c,y=m:60,w=80,h=40)")
	quit.SetPropStr("on:click", "quit()")
}

func main() {
	awtk.Init(320, 480, awtk.APP_DESKTOP, "demo", "res")
	awtk.InitAssets()
	appInit()

	awtk.Run()
}

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn