
简单说明:一个复杂的tableview。
tableview.go
// Copyright 2011 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package main
import (
"fmt"
"math/rand"
"sort"
"strings"
"time"
)
import (
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
)
type Foo struct {
Index int
Bar string
Baz float64
Quux time.Time
checked bool
}
type FooModel struct {
walk.TableModelBase
walk.SorterBase
sortColumn int
sortOrder walk.SortOrder
items []*Foo
}
func NewFooModel() *FooModel {
m := new(FooModel)
m.ResetRows()
return m
}
// Called by the TableView from SetModel and every time the model publishes a
// RowsReset event.
func (m *FooModel) RowCount() int {
return len(m.items)

本文详细介绍了一个使用Walk库实现的复杂Tableview,展示了如何创建、排序和定制显示内容,包括数据模型、事件处理和视觉效果的高级特性。
最低0.47元/天 解锁文章
9万+

被折叠的 条评论
为什么被折叠?



