Ejemplo n.º 1
0
func (tvc *TableViewColumn) create() error {
	var lvc win.LVCOLUMN

	index := tvc.indexInListView()

	lvc.Mask = win.LVCF_FMT | win.LVCF_WIDTH | win.LVCF_TEXT | win.LVCF_SUBITEM
	lvc.ISubItem = index
	lvc.PszText = syscall.StringToUTF16Ptr(tvc.TitleEffective())
	if tvc.width > 0 {
		lvc.Cx = int32(tvc.width)
	} else {
		lvc.Cx = 100
	}

	switch tvc.alignment {
	case AlignCenter:
		lvc.Fmt = 2

	case AlignFar:
		lvc.Fmt = 1
	}

	j := tvc.tv.SendMessage(win.LVM_INSERTCOLUMN, uintptr(index), uintptr(unsafe.Pointer(&lvc)))
	if int(j) == -1 {
		return newError("TableView.SetModel: Failed to insert column.")
	}

	return nil
}
Ejemplo n.º 2
0
func (tvc *TableViewColumn) getLVCOLUMN() *win.LVCOLUMN {
	var lvc win.LVCOLUMN

	lvc.Mask = win.LVCF_FMT | win.LVCF_WIDTH | win.LVCF_TEXT | win.LVCF_SUBITEM
	lvc.ISubItem = int32(tvc.indexInListView())
	lvc.PszText = syscall.StringToUTF16Ptr(tvc.TitleEffective())
	lvc.Cx = int32(tvc.width)

	switch tvc.alignment {
	case AlignCenter:
		lvc.Fmt = 2

	case AlignFar:
		lvc.Fmt = 1
	}

	return &lvc
}