func (f *Form) SetFields(fields []*Field) error { fs := make([]*C.FIELD, 0, len(fields)) for _, value := range fields { fs = append(fs, value.field) } return geterror(C.set_form_fields(f.form, &fs[0])) }
// SetFields overwrites the current fields for the Form with new ones. // It is important to make sure all prior fields have been freed otherwise // this action will result in a memory leak func (f *Form) SetFields(fields []*Field) error { //cfields := make([]*C.FIELD, len(fields)+1) //for index, field := range fields { //cfields[index] = field.field //} //cfields[len(fields)] = nil err := C.set_form_fields(f.form, (**C.FIELD)(unsafe.Pointer(&fields[0]))) return ncursesError(syscall.Errno(err)) }
// SetFields overwrites the current fields for the Form with new ones. // It is important to make sure all prior fields have been freed otherwise // this action will result in a memory leak func (f *Form) SetFields(fields []*Field) error { cfields := make([]*C.FIELD, len(fields)+1) for index, field := range fields { cfields[index] = field.field } cfields[len(fields)] = nil err := C.set_form_fields(f.form, (**C.FIELD)(&cfields[0])) return ncursesError(syscall.Errno(err)) }
func (form *Form) SetFields(fields []*Field) bool { return isOk(C.set_form_fields((*C.FORM)(form), (**C.FIELD)(void(&fields[0])))) }