twgh / xcgui Goto Github PK
View Code? Open in Web Editor NEW炫彩界面库. Go GUI library. Golang bindings for XCGUI, Windows GUI library, DirectUI design idea.
Home Page: https://pkg.go.dev/github.com/twgh/xcgui
License: MIT License
炫彩界面库. Go GUI library. Golang bindings for XCGUI, Windows GUI library, DirectUI design idea.
Home Page: https://pkg.go.dev/github.com/twgh/xcgui
License: MIT License
a := app.New(true)
w := window.New(0, 0, 430, 300, "", 0, xcc.Window_Style_Default)
// 创建Tree
tree := widget.NewTree(12, 33, 400, 260, w.Handle)
tree.SetFont(font.New(50).Handle)
// 创建数据适配器, 这个是必须的, 存储数据的
tree.CreateAdapter()
// 循环添加数据
for i := 0; i < 5; i++ {
// 插入项
index := tree.InsertItemText(fmt.Sprintf("item%d", i), xcc.XC_ID_ROOT, xcc.XC_ID_LAST)
// 插入2个子项
tree.InsertItemText("subitem-1", index, xcc.XC_ID_LAST)
subitemIndex := tree.InsertItemText("subitem-2", index, xcc.XC_ID_LAST)
// 给子项2插入2个子项
tree.InsertItemText("subitem-2-1", subitemIndex, xcc.XC_ID_LAST)
tree.InsertItemText("subitem-2-2", subitemIndex, xcc.XC_ID_LAST)
}
w.ShowWindow(xcc.SW_SHOW)
a.Run()
a.Exit()
XImage_LoadMemory的第一个参数buffer,但是方法的参数需要传递一个整型,好像这个是一个错误?
应该传递进去一个buffer的指针才对?
如果我理解错误,请给一个例子参考。谢谢
Hello,
I like what I have seen in your Xcgui github site but need something that also compile across platforms for Linux and Mac OSX as well as Windows.
Additionally, I am looking to see if you have any examples that show a type of Spreadsheet and also maybe embedding 3D graphics in a window frame as well.
Any information on any of this would be greatly appreciated.
Thanks
list无法添加列文本
复现的代码
package main
import (
"fmt"
"github.com/twgh/xcgui/app"
"github.com/twgh/xcgui/widget"
"github.com/twgh/xcgui/window"
"github.com/twgh/xcgui/xcc"
)
func main() {
a := app.New("")
win := window.NewWindow(0, 0, 466, 300, "炫彩窗口", 0, xcc.Xc_Window_Style_Default)
list := widget.NewList(50, 50, 300, 300, win.Handle)
list.CreateAdapterHeader()
list.CreateAdapter()
list.AddColumnText(50, "test1", "aaa") //没有显示文本出来
list.AddColumnText(100, "test2", "bbb") //没有显示文本出来
list.AddColumnText(100, "test3", "ccc") //没有显示文本出来
for i:=0; i < 10; i++ {
index := list.AddItemText(fmt.Sprintf("item-%d", i))
list.SetItemText(index, 1, fmt.Sprintf("subitem-%d", i))
list.SetItemText(index, 2, fmt.Sprintf("subitem-%d", i))
}
win.ShowWindow(xcc.SW_SHOW)
a.Run()
a.Exit()
}
ShapeText能否部分字样进行颜色处理,因为一段文本有个别字要进行高亮处理
感谢🌹🌹🌹
之前用过tview与fyne,都有一个问题:【usb发送与接收帧频很慢】
简单界面主流程插了好几个goroutine,分别用于timer,usb 发送,接收,数据处理以及显示刷新,用channel通信。
我在timer里定义每秒30次,实际每秒只有1、2次,【在tview界面我滑动鼠标时通讯速率貌似就正常了】,但我不是专业软件专业水平有限,没找到怎么在程序内部调整这个刷新率。
刚搜到xcgui,不知是否同样存在同样的现象。下周有空试试。
我想问下这个项目可以控制鼠标的行为吗,就操作鼠标在多屏幕上的行为操作
而不是像现在一样放到临时目录、或者exe同一级目录,或者 C:/windows/system32 目录
func main() {
a := app.New(true)
a.LoadResource("resource.res")
//a.LoadResourceZip("xcgui.zip", "resource.res", "")
// 从zip中加载布局文件
hWindow := a.LoadLayout("main.xml", 0, 0)
if hWindow == 0 {
panic("error")
}
//隐藏对应的id
laylist := widget.NewLayoutFrameByName("list")
//主线程ui
go func() {
a.CallUiThread(func(data int) int {
laylist.Show(false)
return 0
}, 0)
}()
// 创建窗口对象
win := window.NewWindowByHandle(hWindow)
//通过name获取对象句柄
btn := widget.NewButtonByName("btn")
//添加绑定事件
btn.Event_BnClick(func(pbHandled *bool) int {
go func() {
a.CallUiThread(func(data int) int {
laylist.Show(false)
win.AdjustLayout()
return 0
}, 0)
}()
return btn1(win.GetHWND())
})
// 调整布局
win.AdjustLayout()
// 显示窗口
win.ShowWindow(xcc.SW_SHOW)
a = s
w = hWindow
a.SetPaintFrequency(10)
a.Run()
a.Exit()
}
绑定事件点击按钮,触发的事件显示layoutframe,窗口的layoutframe没有及时显示,滚动或者缩放才会变化
Bug 描述
a := app.New(true)
w := window.NewByLayoutStringW(str, 0, 0)
w.AdjustLayout()
bth := a.GetObjectByName("btn1")
fmt.Println(bth)
bt1 := widget.NewButtonByHandle(bth)
fmt.Println(bt1.Handle)
bmk := bkmanager.NewByHandle(bt1.Handle)
fmt.Println(bmk.Handle)
if bmk != nil {
bmk.SetInfo("{99:1.9.9;98:16(0)32(1)64(2);5:2(15)20(1)21(3)26(1)22(-7839744)23(255)9(5,5,5,5);5:2(15)20(1)21(3)26(1)22(-4094208)23(255)9(5,5,5,5);5:2(15)20(1)21(3)26(1)22(-7839744)23(255)9(5,5,5,5);}")
} else {
fmt.Println("Error")
}
版本:
windows 11
golang 1.20.0
xcgui.dll 3.3.9.0
其他
是我的写法有问题吗?有没有例子
XEdit_GetText获取不到结果,我看注释写着未实现
failed to GetSelectAll in ListView
func (l *ListView) GetSelectAll(pArray int, nArraySize int) int {
return xc.XListView_GetSelectAll(l.Handle, pArray, nArraySize)
}
I think the 1st arg should be a pointer to an array but not an int.
package main
import (
_ "embed"
"github.com/twgh/xcgui/app"
"github.com/twgh/xcgui/widget"
"github.com/twgh/xcgui/window"
"github.com/twgh/xcgui/xc"
"github.com/twgh/xcgui/xcc"
)
//go:embed 2.gif
var img1 []byte
func main() {
a := app.New(true)
w := window.NewWindow(0, 0, 415, 296, "", 0, xcc.Window_Style_Default)
// 加载图片从内存
hImg := xc.XImage_LoadMemory(img1)
shapePic := widget.NewShapeGif(8, 30, 400, 260, w.Handle)
shapePic.SetImage(hImg)
w.ShowWindow(xcc.SW_SHOW)
a.Run()
a.Exit()
}
不停的调用XC_CallUiThread会报fatal error: too many callback functions错误
这两个帖子好像也提到了超过2000次后会出问题
https://stackoverflow.com/questions/66864829/golang-fatal-error-too-many-callback-functions
golang/go#1912
复现代码
package main
import (
"fmt"
"github.com/twgh/xcgui/app"
"github.com/twgh/xcgui/widget"
"github.com/twgh/xcgui/window"
"github.com/twgh/xcgui/xc"
"github.com/twgh/xcgui/xcc"
"time"
)
func main() {
a := app.New("")
win := window.NewWindow(0, 0, 466, 300, "炫彩窗口", 0, xcc.Xc_Window_Style_Default)
logEdit := widget.NewEdit(100, 100, 100, 100, win.Handle)
btn_test := widget.NewButton(250, 150, 50, 50, "点击", win.Handle)
btn_test.Event_BnClick(func(pbHandled *bool) int {
*pbHandled = true
go func() {
// 不断的调用会报错
for ;; {
xc.XC_CallUiThread(func(data int) int {
timeStyle := logEdit.AddStyleEx("微软雅黑",10, 0, xc.RGB(255, 255, 255), true)
logEdit.AddTextEx(fmt.Sprintf("%s: ", time.Now().Format("2006-01-02 15:04:05")), timeStyle)
return 0
}, 1)
time.Sleep(500 * time.Microsecond)
}
}()
return 0
})
// 3.显示窗口
win.ShowWindow(xcc.SW_SHOW)
// 4.运行程序
a.Run()
// 5.释放UI库
a.Exit()
}
hi,想请教一下~
这个是否支持mac的客户端ui呢?
Bug 描述
对错误是什么的清晰描述。
预期行为
清晰的描述您期望发生的事情。
截图
如果可以,请添加屏幕截图以帮助解释您的问题。
系统:
系统和版本。
其他
其他想说的。
Bug 描述
对错误是什么的清晰描述。
预期行为
清晰的描述您期望发生的事情。
截图
如果可以,请添加屏幕截图以帮助解释您的问题。
系统:
系统和版本。
其他
其他想说的。
an := ani.NewAnima(w.Handle, 1)
an.Move(100, 500, 0, 1, xcc.Ease_Flag_Linear, false)
an.SetCallBack(anCallback)
an.Run(w.Handle)
when i try to set callback for animation, get below panic.
panic: Failed to find XAnima_SetCallBack procedure in xcgui.dll: The specified procedure could not be found.
any help please?
很多人可能没有写过GUI类型的软件,或者没有接触过DriectUI类型的界面库,因此我不知道你们的疑惑会在哪里,需要哪方面更深入的例子,我需要根据你们的需求来继续写出更多的例子,以供所有人查看,请畅所欲言。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.