Removed error returns from Combobox.Delete(), Listbox.Delete(), and sysData.delete(), since they are no longer used. Updated the TODO file to mark this issue closed.
This commit is contained in:
parent
c43583fe20
commit
92fb9efce9
|
@ -78,7 +78,7 @@ badrange:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete removes the given item from the Combobox. It panics if the given index is out of bounds.
|
// Delete removes the given item from the Combobox. It panics if the given index is out of bounds.
|
||||||
func (c *Combobox) Delete(index int) error {
|
func (c *Combobox) Delete(index int) {
|
||||||
c.lock.Lock()
|
c.lock.Lock()
|
||||||
defer c.lock.Unlock()
|
defer c.lock.Unlock()
|
||||||
|
|
||||||
|
@ -86,13 +86,14 @@ func (c *Combobox) Delete(index int) error {
|
||||||
if index < 0 || index >= c.sysData.len() {
|
if index < 0 || index >= c.sysData.len() {
|
||||||
goto badrange
|
goto badrange
|
||||||
}
|
}
|
||||||
return c.sysData.delete(index)
|
c.sysData.delete(index)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if index < 0 || index >= len(c.initItems) {
|
if index < 0 || index >= len(c.initItems) {
|
||||||
goto badrange
|
goto badrange
|
||||||
}
|
}
|
||||||
c.initItems = append(c.initItems[:index], c.initItems[index + 1:]...)
|
c.initItems = append(c.initItems[:index], c.initItems[index + 1:]...)
|
||||||
return nil
|
return
|
||||||
badrange:
|
badrange:
|
||||||
panic(fmt.Errorf("index %d out of range in Combobox.Delete()", index))
|
panic(fmt.Errorf("index %d out of range in Combobox.Delete()", index))
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ badrange:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete removes the given item from the Listbox. It panics if the given index is out of bounds.
|
// Delete removes the given item from the Listbox. It panics if the given index is out of bounds.
|
||||||
func (l *Listbox) Delete(index int) error {
|
func (l *Listbox) Delete(index int) {
|
||||||
l.lock.Lock()
|
l.lock.Lock()
|
||||||
defer l.lock.Unlock()
|
defer l.lock.Unlock()
|
||||||
|
|
||||||
|
@ -78,13 +78,14 @@ func (l *Listbox) Delete(index int) error {
|
||||||
if index < 0 || index >= l.sysData.len() {
|
if index < 0 || index >= l.sysData.len() {
|
||||||
goto badrange
|
goto badrange
|
||||||
}
|
}
|
||||||
return l.sysData.delete(index)
|
l.sysData.delete(index)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
if index < 0 || index >= len(l.initItems) {
|
if index < 0 || index >= len(l.initItems) {
|
||||||
goto badrange
|
goto badrange
|
||||||
}
|
}
|
||||||
l.initItems = append(l.initItems[:index], l.initItems[index + 1:]...)
|
l.initItems = append(l.initItems[:index], l.initItems[index + 1:]...)
|
||||||
return nil
|
return
|
||||||
badrange:
|
badrange:
|
||||||
panic(fmt.Errorf("index %d out of range in Listbox.Delete()", index))
|
panic(fmt.Errorf("index %d out of range in Listbox.Delete()", index))
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,7 +61,7 @@ func (c *cSysData) selectedTexts() []string {
|
||||||
func (c *cSysData) setWindowSize(int, int) error {
|
func (c *cSysData) setWindowSize(int, int) error {
|
||||||
panic(runtime.GOOS + " sysData does not define setWindowSize()")
|
panic(runtime.GOOS + " sysData does not define setWindowSize()")
|
||||||
}
|
}
|
||||||
func (c *cSysData) delete(int) error {
|
func (c *cSysData) delete(int) {
|
||||||
panic(runtime.GOOS + " sysData does not define delete()")
|
panic(runtime.GOOS + " sysData does not define delete()")
|
||||||
}
|
}
|
||||||
func (c *cSysData) preferredSize() (int, int) {
|
func (c *cSysData) preferredSize() (int, int) {
|
||||||
|
|
|
@ -449,7 +449,7 @@ func (s *sysData) setWindowSize(width int, height int) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) delete(index int) error {
|
func (s *sysData) delete(index int) {
|
||||||
ret := make(chan struct{})
|
ret := make(chan struct{})
|
||||||
defer close(ret)
|
defer close(ret)
|
||||||
uitask <- func() {
|
uitask <- func() {
|
||||||
|
@ -457,7 +457,6 @@ func (s *sysData) delete(index int) error {
|
||||||
ret <- struct{}{}
|
ret <- struct{}{}
|
||||||
}
|
}
|
||||||
<-ret
|
<-ret
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) setProgress(percent int) {
|
func (s *sysData) setProgress(percent int) {
|
||||||
|
|
|
@ -275,7 +275,7 @@ func (s *sysData) setWindowSize(width int, height int) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) delete(index int) error {
|
func (s *sysData) delete(index int) {
|
||||||
ret := make(chan struct{})
|
ret := make(chan struct{})
|
||||||
defer close(ret)
|
defer close(ret)
|
||||||
uitask <- func() {
|
uitask <- func() {
|
||||||
|
@ -283,7 +283,6 @@ func (s *sysData) delete(index int) error {
|
||||||
ret <- struct{}{}
|
ret <- struct{}{}
|
||||||
}
|
}
|
||||||
<-ret
|
<-ret
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) setProgress(percent int) {
|
func (s *sysData) setProgress(percent int) {
|
||||||
|
|
|
@ -494,7 +494,7 @@ func (s *sysData) setWindowSize(width int, height int) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) delete(index int) (err error) {
|
func (s *sysData) delete(index int) {
|
||||||
ret := make(chan uiret)
|
ret := make(chan uiret)
|
||||||
defer close(ret)
|
defer close(ret)
|
||||||
uitask <- &uimsg{
|
uitask <- &uimsg{
|
||||||
|
@ -509,9 +509,8 @@ func (s *sysData) delete(index int) (err error) {
|
||||||
}
|
}
|
||||||
r := <-ret
|
r := <-ret
|
||||||
if r.ret == uintptr(classTypes[s.ctype].selectedIndexErr) {
|
if r.ret == uintptr(classTypes[s.ctype].selectedIndexErr) {
|
||||||
return fmt.Errorf("failed to delete item from combobox/listbox (last error: %v)", r.err)
|
panic(fmt.Errorf("failed to delete item from combobox/listbox (last error: %v)", r.err))
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) setProgress(percent int) {
|
func (s *sysData) setProgress(percent int) {
|
||||||
|
|
3
todo.md
3
todo.md
|
@ -17,8 +17,7 @@ so I don't forget:
|
||||||
- Combobox/Listbox.Select (with Listbox.Select allowing bulk)
|
- Combobox/Listbox.Select (with Listbox.Select allowing bulk)
|
||||||
- Checkbox.Check or Checkbox.SetChecked
|
- Checkbox.Check or Checkbox.SetChecked
|
||||||
- Listbox.SelectAll
|
- Listbox.SelectAll
|
||||||
- have Listbox.Delete() panic on invalid index; it does not yet due to the Mac OS X signaling issue mentioned under "super important"
|
- have methods that take indices panic on invalid index, like the Stack and Grid stretchy methods
|
||||||
- same for other methods that take indices, like the Stack and Grid stretchy methods
|
|
||||||
- make the Windows implementation of message boxes run on uitask
|
- make the Windows implementation of message boxes run on uitask
|
||||||
- ensure MsgBoxError can run if initialization failed if things change ever
|
- ensure MsgBoxError can run if initialization failed if things change ever
|
||||||
- should Labels be selectable?
|
- should Labels be selectable?
|
||||||
|
|
Loading…
Reference in New Issue