Beispiel #1
0
func (this *ListView) ItemAtIndex(i int) *w32.LVITEM {
	var item w32.LVITEM
	item.Mask = w32.LVIF_PARAM | w32.LVIF_TEXT
	item.IItem = i

	this.Item(&item)
	return &item
}
Beispiel #2
0
func (this *ListView) AddItem(text ...string) {
	if len(text) > 0 {
		var li w32.LVITEM
		li.Mask = w32.LVIF_TEXT
		li.PszText = syscall.StringToUTF16Ptr(text[0])
		li.IItem = this.ItemCount()

		this.InsertLvItem(&li)

		for i := 1; i < len(text); i++ {
			li.PszText = syscall.StringToUTF16Ptr(text[i])
			li.ISubItem = i

			this.SetLvItem(&li)
		}
	}
}
Beispiel #3
0
// mask is used to set the LVITEM.Mask for ListView.GetItem which indicates which attributes you'd like to receive
// of LVITEM.
func (this *ListView) SelectedItems(mask uint) []*w32.LVITEM {
	items := make([]*w32.LVITEM, 0)

	var i int = -1
	for {
		if i = int(w32.SendMessage(this.hwnd, w32.LVM_GETNEXTITEM, uintptr(i), uintptr(w32.LVNI_SELECTED))); i == -1 {
			break
		}

		var item w32.LVITEM
		item.Mask = mask
		item.IItem = i
		if this.Item(&item) {
			items = append(items, &item)
		}
	}
	return items
}