gui: add query shortcut, or switch tab if not focused
This commit is contained in:
parent
ef30a0d210
commit
5e0422e10f
16
main.go
16
main.go
@ -77,9 +77,19 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
||||
mnuFileExit.SetOnClick(f.OnMnuFileExitClick)
|
||||
mnuFile.Add(mnuFileExit)
|
||||
|
||||
mnuQuery := vcl.NewMenuItem(f)
|
||||
mnuQuery.SetCaption("Query")
|
||||
|
||||
mnuQueryExecute := vcl.NewMenuItem(mnuQuery)
|
||||
mnuQueryExecute.SetCaption("Execute")
|
||||
mnuQueryExecute.SetShortCutFromString("F5")
|
||||
mnuQueryExecute.SetOnClick(f.OnQueryExecute)
|
||||
mnuQuery.Add(mnuQueryExecute)
|
||||
|
||||
f.Menu = vcl.NewMainMenu(f)
|
||||
f.Menu.SetImages(f.ImageList)
|
||||
f.Menu.Items().Add(mnuFile)
|
||||
f.Menu.Items().Add(mnuQuery)
|
||||
|
||||
//
|
||||
|
||||
@ -203,6 +213,12 @@ func (f *TMainForm) OnMnuFileExitClick(sender vcl.IObject) {
|
||||
}
|
||||
|
||||
func (f *TMainForm) OnQueryExecute(sender vcl.IObject) {
|
||||
// If query tab is not selected, switch to it, but do not exec
|
||||
if f.Tabs.ActivePageIndex() != 2 {
|
||||
f.Tabs.SetActivePageIndex(2)
|
||||
return
|
||||
}
|
||||
|
||||
// Execute
|
||||
node := f.Buckets.Selected()
|
||||
if node == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user