Comments (9)
测试并无问题啊,不知道你是怎么操作的。
这是我使用listviewvirtualdata
例子测试的代码:
data := TTempItem{Caption: "标题", Sub1: "子项1", Sub2: "子项2", Sub3: "子项3", Sub4: "子项4", Sub5: "子项5", Checked: false}
tempData = append(tempData, data)
f.ListView.Items().SetCount(int32(len(tempData)))
from govcl.
` f.isWindows = runtime.GOOS == "windows"
fmt.Println("OnCreate")
f.SetWidth(800)
f.SetHeight(600)
f.ScreenCenter()
f.SetDoubleBuffered(true)
//============重绘表显示
f.Timer1 = vcl.NewTimer(f)
f.Timer1.SetOnTimer(f.OnTimer1Timer)
f.Timer1.SetEnabled(true)
f.Timer1.SetInterval(1000)
//==========================
f.ListView = vcl.NewListView(f)
f.ListView.SetAlign(types.AlClient)
f.ListView.SetParent(f)
f.ListView.SetViewStyle(types.VsReport)
f.ListView.SetOwnerData(true)
f.ListView.SetGridLines(true)
f.ListView.SetReadOnly(true)
f.ListView.SetRowSelect(true)
f.ListView.SetOnData(f.OnListView1Data)
// 要显示状态图标就得添加
// lazarus 2.2又出新bug了,,windows下ownerdata时会异常
f.ListView.SetCheckboxes(!f.isWindows)
//f.ListView.SetCheckboxes(true)
// windows下OwnerData不能显示checkbox
// linux和macOS在OwnerData下支持显示CheckBox
if f.isWindows {
// 这里模拟显示
f.stateImages = vcl.NewImageList(f)
bmpFileName := "checkbox.png"
if rtl.FileExists(bmpFileName) {
pic := vcl.NewPicture()
pic.LoadFromFile(bmpFileName)
f.stateImages.AddSliced(pic.Bitmap(), 1, 2)
pic.Free()
}
f.ListView.SetStateImages(f.stateImages)
f.ListView.SetOnMouseDown(f.OnListView1MouseDown)
}
col := f.ListView.Columns().Add()
col.SetCaption("行号")
col.SetWidth(100)
col = f.ListView.Columns().Add()
col.SetCaption("子项1")
col.SetWidth(100)
col = f.ListView.Columns().Add()
col.SetCaption("子项2")
col.SetWidth(100)
col = f.ListView.Columns().Add()
col.SetCaption("子项3")
col.SetWidth(100)
col = f.ListView.Columns().Add()
col.SetCaption("子项4")
col.SetWidth(100)
col = f.ListView.Columns().Add()
col.SetCaption("子项5")
col.SetWidth(100)
//=============================== 这里 生成一个数据 下面就会出现 不会刷新 如果你生成2个数据就正常
tempData = make([]TTempItem, 1)
t := time.Now().UnixNano()
for i := 0; i < len(tempData); i++ {
tempData[i].Caption = fmt.Sprintf("%d", i+1)
tempData[i].Sub1 = fmt.Sprintf("子项1:%d", rand.Intn(1000000))
tempData[i].Sub2 = fmt.Sprintf("子项2:%d", rand.Intn(1000000))
tempData[i].Sub3 = fmt.Sprintf("子项3:%d", rand.Intn(1000000))
tempData[i].Sub4 = fmt.Sprintf("子项4:%d", rand.Intn(1000000))
tempData[i].Sub5 = fmt.Sprintf("子项5:%d", rand.Intn(1000000))
tempData[i].Checked = false
}
go func() {
index := 0
for {
vcl.ThreadSync(func() {
// 这里目前是1 不会正常刷新显示 如果上面生成2条数据以上就正常
tempData[0].Sub5 = strconv.Itoa(index)
//tempData[1].Sub5 = strconv.Itoa(index)
index++
})
time.Sleep(time.Second * 1)
}
}()`
from govcl.
你这更新数据内容,需要调用控件的重绘(Repaint)之类的方法。
from govcl.
我那个已经调用一秒重绘一次了,问题就是一行数据就不会重绘,两行以上的数据就正常,你可以测试一下就知道了
from govcl.
我用你这个代码测试了下,没有发现问题,可以正常更新。你可以考虑下用最新的lazarus重新编译下liblcl看看。
from govcl.
我这里如果是两条数据以上也是正常刷新的,就是一条数据的时候才不正常刷新,永远是0
from govcl.
刚准备上传个新的liblcl,发现不行哦,得自己编译的才可以。
from govcl.
还是不行,会不会是win11的问题?这个问题不大,但是我觉得很奇怪,解决不了就不管他了 ,反正不影响使用
from govcl.
不知道,我在win10上编译的
from govcl.
Related Issues (20)
- 怎么将go image包的Image转换成vcl.IGraphic实例? HOT 15
- 怎么让一个画布重绘? HOT 2
- example中有很多gfm文件,用lazarus也打不开啊。要怎么转换格式才能打开呢 HOT 1
- 报错 HOT 3
- Button的Caption值能否支持换行,或使用其他控件 HOT 1
- TreeView再SetData后,用Data函数得到的指针总是错的。TreeNode的地址总是在改变,尽管里面的Instance指针是不变的 HOT 1
- 能否支持Virtual TreeView呢? HOT 1
- windows系统下,管理员检测不对 HOT 2
- MacOS 下面XButton的Caption字体模糊 HOT 7
- 为什么不使用 syscall.LazyDLL 加载 liblcl 模块? 应该允许用户在调用 vcl.Application.Initialize 初始化之前动态释放 liblcl模块. HOT 1
- mac平台go build报错 HOT 3
- 自定义 LibName 不支持 go1.21.1 以上版本 HOT 5
- centos 环境panic goroutine ,window环境正常 HOT 3
- RichEdit Lines().Add 能否每行字都设置独立的颜色呢 HOT 5
- TImage 的 BeginDrag(bool)方法没有 HOT 2
- Linux 下的 TdateTimePicker 样式是不是有字符上显示的问题 HOT 2
- 我要实现一个类似设计器的功能 应该用哪个组件 HOT 1
- 请教关于嵌入式浏览器的问题? HOT 3
- vcl.TStrings报错 HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from govcl.