Made the buttons in the file browser example work
This commit is contained in:
parent
14802b4b82
commit
7ec5e1ab2a
@ -137,7 +137,10 @@ func (element *DirectoryView) Update () error {
|
|||||||
element.children[index].DirEntry = entry
|
element.children[index].DirEntry = entry
|
||||||
}
|
}
|
||||||
|
|
||||||
element.redoAll()
|
if element.core.HasImage() {
|
||||||
|
element.redoAll()
|
||||||
|
element.core.DamageAll()
|
||||||
|
}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,12 +42,16 @@ func run () {
|
|||||||
|
|
||||||
scrollContainer := containers.NewScrollContainer(false, true)
|
scrollContainer := containers.NewScrollContainer(false, true)
|
||||||
directoryView, _ := fileElements.NewDirectoryView(homeDir, nil)
|
directoryView, _ := fileElements.NewDirectoryView(homeDir, nil)
|
||||||
choose := func (filePath string) {
|
updateStatus := func () {
|
||||||
directoryView.SetLocation(filePath, nil)
|
filePath, _ := directoryView.Location()
|
||||||
directory.SetLocation(filePath, nil)
|
directory.SetLocation(filePath, nil)
|
||||||
locationInput.SetValue(filePath)
|
locationInput.SetValue(filePath)
|
||||||
baseName.SetText(filepath.Base(filePath))
|
baseName.SetText(filepath.Base(filePath))
|
||||||
}
|
}
|
||||||
|
choose := func (filePath string) {
|
||||||
|
directoryView.SetLocation(filePath, nil)
|
||||||
|
updateStatus()
|
||||||
|
}
|
||||||
directoryView.OnChoose(choose)
|
directoryView.OnChoose(choose)
|
||||||
locationInput.OnEnter (func () {
|
locationInput.OnEnter (func () {
|
||||||
choose(locationInput.Value())
|
choose(locationInput.Value())
|
||||||
@ -55,12 +59,19 @@ func run () {
|
|||||||
choose(homeDir)
|
choose(homeDir)
|
||||||
backButton.OnClick (func () {
|
backButton.OnClick (func () {
|
||||||
directoryView.Backward()
|
directoryView.Backward()
|
||||||
|
updateStatus()
|
||||||
})
|
})
|
||||||
forwardButton.OnClick (func () {
|
forwardButton.OnClick (func () {
|
||||||
directoryView.Forward()
|
directoryView.Forward()
|
||||||
|
updateStatus()
|
||||||
})
|
})
|
||||||
refreshButton.OnClick (func () {
|
refreshButton.OnClick (func () {
|
||||||
directoryView.Update()
|
directoryView.Update()
|
||||||
|
updateStatus()
|
||||||
|
})
|
||||||
|
upwardButton.OnClick (func () {
|
||||||
|
filePath, _ := directoryView.Location()
|
||||||
|
choose(filepath.Dir(filePath))
|
||||||
})
|
})
|
||||||
|
|
||||||
controlBar.Adopt(backButton, false)
|
controlBar.Adopt(backButton, false)
|
||||||
|
Reference in New Issue
Block a user