bolt: support 'create new database'
This commit is contained in:
parent
feffa67677
commit
ce43f5765c
11
main.go
11
main.go
@ -64,6 +64,7 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
|||||||
mnuFileBolt.SetImageIndex(imgVendorGithub)
|
mnuFileBolt.SetImageIndex(imgVendorGithub)
|
||||||
mnuFile.Add(mnuFileBolt)
|
mnuFile.Add(mnuFileBolt)
|
||||||
|
|
||||||
|
vcl_menuitem(mnuFileBolt, "New database...", imgDatabaseAdd, f.OnMnuFileBoltNewClick)
|
||||||
vcl_menuitem(mnuFileBolt, "Open database...", imgDatabaseAdd, f.OnMnuFileBoltOpenClick)
|
vcl_menuitem(mnuFileBolt, "Open database...", imgDatabaseAdd, f.OnMnuFileBoltOpenClick)
|
||||||
vcl_menuitem(mnuFileBolt, "Open database (read-only)...", imgDatabaseAdd, f.OnMnuFileBoltOpenReadonlyClick)
|
vcl_menuitem(mnuFileBolt, "Open database (read-only)...", imgDatabaseAdd, f.OnMnuFileBoltOpenReadonlyClick)
|
||||||
|
|
||||||
@ -246,6 +247,16 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
|||||||
f.OnNavChange(f, nil) // calls f.none.RenderForNav and sets up status bar content
|
f.OnNavChange(f, nil) // calls f.none.RenderForNav and sets up status bar content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *TMainForm) OnMnuFileBoltNewClick(sender vcl.IObject) {
|
||||||
|
dlg := vcl.NewSaveDialog(f)
|
||||||
|
dlg.SetTitle("Save database as...")
|
||||||
|
dlg.SetFilter("Bolt database|*.db|All files|*.*")
|
||||||
|
ret := dlg.Execute() // Fake blocking
|
||||||
|
if ret {
|
||||||
|
f.boltAddDatabaseFromFile(dlg.FileName(), false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (f *TMainForm) OnMnuFileBoltOpenClick(sender vcl.IObject) {
|
func (f *TMainForm) OnMnuFileBoltOpenClick(sender vcl.IObject) {
|
||||||
dlg := vcl.NewOpenDialog(f)
|
dlg := vcl.NewOpenDialog(f)
|
||||||
dlg.SetTitle("Select a database file...")
|
dlg.SetTitle("Select a database file...")
|
||||||
|
Loading…
Reference in New Issue
Block a user