Giter Club home page Giter Club logo

xcgui's Issues

[提问] tree设置字体及字号没有效果,xcgui3.3.8

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()

代码编辑框提示错误

错误:panic: Failed to find XEditor_SetStyleFunction procedure in xcgui.dll: The specified procedure could not be found.

备注: 自带的代码编辑框的demo, 出错. 把 3.3.3的dll复制过来又可以. 是否这个函数被删除了?

1

image.NewImage_LoadMemory的使用

XImage_LoadMemory的第一个参数buffer,但是方法的参数需要传递一个整型,好像这个是一个错误?
应该传递进去一个buffer的指针才对?

如果我理解错误,请给一个例子参考。谢谢

Does xcgui also compile for Linux and MacOSX

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无法添加列文本

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()
}

[提问] goroutine刷新率问题

感谢🌹🌹🌹
之前用过tview与fyne,都有一个问题:【usb发送与接收帧频很慢】

简单界面主流程插了好几个goroutine,分别用于timer,usb 发送,接收,数据处理以及显示刷新,用channel通信。
我在timer里定义每秒30次,实际每秒只有1、2次,【在tview界面我滑动鼠标时通讯速率貌似就正常了】,但我不是专业软件专业水平有限,没找到怎么在程序内部调整这个刷新率。
刚搜到xcgui,不知是否同样存在同样的现象。下周有空试试。

lauyoutframe 设置隐藏 UI线程没及时隐藏和显示

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没有及时显示,滚动或者缩放才会变化

image

[BUG] bkmanager.setInfo 无法正常工作。

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

其他
是我的写法有问题吗?有没有例子

[BUG]

Bug 描述
目前循环调用以下函数一段时间后会触发句柄失效的情况,使用go run或者go build编译成exe文件都会,但是用goland运行程序就不会有这个情况

预期行为
清晰的描述您期望发生的事情。
不会报错
截图
如果可以,请添加屏幕截图以帮助解释您的问题。
1705817956702
image
image

系统:
win11

其他
其他想说的。

[BUG] failed to GetSelectAll in ListView

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.

Gif图片无法显示出来

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()
}

fatal error: too many callback functions

不停的调用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()
}

是否支持无显卡或者核显运行流畅?

Bug 描述
对错误是什么的清晰描述。

预期行为
清晰的描述您期望发生的事情。

截图
如果可以,请添加屏幕截图以帮助解释您的问题。

系统:
系统和版本。

其他
其他想说的。

需要特定例子/写法的可以在本贴下面留言

很多人可能没有写过GUI类型的软件,或者没有接触过DriectUI类型的界面库,因此我不知道你们的疑惑会在哪里,需要哪方面更深入的例子,我需要根据你们的需求来继续写出更多的例子,以供所有人查看,请畅所欲言。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.