Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichEdit.Text() 无法正确返回中文, RichEdit.Lines().Text()正常 #212

Open
fcying opened this issue Oct 7, 2024 · 2 comments
Open
Labels

Comments

@fcying
Copy link

fcying commented Oct 7, 2024

测试代码, 就是按btn后, 打印RichEdit内容, RichEdit.Text()无法正确显示, 感觉是长度不对? RichEdit.Lines().Text() 能正常显示, 这两个有什么差别吗?

type TMainForm struct {
	*vcl.TForm
	Open        *vcl.TButton
	Input       *vcl.TRichEdit
	splitter    *vcl.TSplitter
	Output      *vcl.TRichEdit
}

var (
	mainForm         *TMainForm
	inputPlaceholder string = "123中文测试456"
)

	f.Input = vcl.NewRichEdit(mainForm)
	f.Input.SetParent(rightPane)
	f.Input.SetMaxLength(1000)
	f.Input.SetAlign(types.AlTop)
	f.Input.SetTextBuf(inputPlaceholder)
}

func (f *TMainForm) onOpenClick(sender vcl.IObject) {
	fmt.Printf("len:%d data:%s lineData:%s\n", f.Input.GetTextLen(), f.Input.Text(), f.Input.Lines().Text())
}

image

@ying32
Copy link
Owner

ying32 commented Oct 7, 2024

如果数据量不大,可以用用lines.text的,另一方法本来是为了解决超大字符串的,以前测试过没啥问题,不知道咋的,看你这个又出现问题了,我到时候看看是什么问题。

@fcying
Copy link
Author

fcying commented Oct 7, 2024

看来昨晚碰到的 access violation 是字符串太长的问题了....
大概 1M 的数据, Lines().Text() 就会报这个错误了.

@ying32 ying32 added the bug label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants