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.redoAll()
|
||||
if element.core.HasImage() {
|
||||
element.redoAll()
|
||||
element.core.DamageAll()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -42,12 +42,16 @@ func run () {
|
||||
|
||||
scrollContainer := containers.NewScrollContainer(false, true)
|
||||
directoryView, _ := fileElements.NewDirectoryView(homeDir, nil)
|
||||
choose := func (filePath string) {
|
||||
directoryView.SetLocation(filePath, nil)
|
||||
updateStatus := func () {
|
||||
filePath, _ := directoryView.Location()
|
||||
directory.SetLocation(filePath, nil)
|
||||
locationInput.SetValue(filePath)
|
||||
baseName.SetText(filepath.Base(filePath))
|
||||
}
|
||||
choose := func (filePath string) {
|
||||
directoryView.SetLocation(filePath, nil)
|
||||
updateStatus()
|
||||
}
|
||||
directoryView.OnChoose(choose)
|
||||
locationInput.OnEnter (func () {
|
||||
choose(locationInput.Value())
|
||||
@ -55,12 +59,19 @@ func run () {
|
||||
choose(homeDir)
|
||||
backButton.OnClick (func () {
|
||||
directoryView.Backward()
|
||||
updateStatus()
|
||||
})
|
||||
forwardButton.OnClick (func () {
|
||||
directoryView.Forward()
|
||||
updateStatus()
|
||||
})
|
||||
refreshButton.OnClick (func () {
|
||||
directoryView.Update()
|
||||
updateStatus()
|
||||
})
|
||||
upwardButton.OnClick (func () {
|
||||
filePath, _ := directoryView.Location()
|
||||
choose(filepath.Dir(filePath))
|
||||
})
|
||||
|
||||
controlBar.Adopt(backButton, false)
|
||||
|
Reference in New Issue
Block a user