gui: toggle the Query form fields if selected db is not queryable
This commit is contained in:
parent
90259fb2b9
commit
0f2a3e021a
24
main.go
24
main.go
@ -41,6 +41,7 @@ type TMainForm struct {
|
||||
insertRows map[int32]struct{} // Rows in the StringGrid that are to-be-inserted
|
||||
deleteRows map[int32]struct{}
|
||||
updateRows map[int32][]int32 // Row->cells that are to-be-updated
|
||||
queryExecBtn *vcl.TToolButton
|
||||
queryInput *vcl.TRichEdit
|
||||
queryResult *vcl.TStringGrid
|
||||
|
||||
@ -286,12 +287,12 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
||||
queryButtonBar.SetImages(f.ImageList)
|
||||
queryButtonBar.SetShowCaptions(true)
|
||||
|
||||
queryExecBtn := vcl.NewToolButton(queryButtonBar)
|
||||
queryExecBtn.SetParent(queryButtonBar)
|
||||
queryExecBtn.SetHint("Execute")
|
||||
queryExecBtn.SetShowHint(true)
|
||||
queryExecBtn.SetImageIndex(imgResultsetNext)
|
||||
queryExecBtn.SetOnClick(f.OnQueryExecute)
|
||||
f.queryExecBtn = vcl.NewToolButton(queryButtonBar)
|
||||
f.queryExecBtn.SetParent(queryButtonBar)
|
||||
f.queryExecBtn.SetHint("Execute")
|
||||
f.queryExecBtn.SetShowHint(true)
|
||||
f.queryExecBtn.SetImageIndex(imgResultsetNext)
|
||||
f.queryExecBtn.SetOnClick(f.OnQueryExecute)
|
||||
|
||||
f.queryInput = vcl.NewRichEdit(queryTab)
|
||||
f.queryInput.SetParent(queryTab)
|
||||
@ -808,6 +809,17 @@ func (f *TMainForm) OnNavChange(sender vcl.IObject, node *vcl.TTreeNode) {
|
||||
f.contentBox.SetEnabled(false)
|
||||
}
|
||||
|
||||
// Toggle the Query functionality
|
||||
if _, ok := ld.(queryableLoadedDatabase); ok {
|
||||
f.queryInput.SetEnabled(true)
|
||||
f.queryResult.SetEnabled(true)
|
||||
f.queryExecBtn.SetEnabled(true)
|
||||
} else {
|
||||
f.queryInput.SetEnabled(false)
|
||||
f.queryResult.SetEnabled(false)
|
||||
f.queryExecBtn.SetEnabled(false)
|
||||
}
|
||||
|
||||
// We're in charge of common status bar text updates
|
||||
f.StatusBar.SetSimpleText(ld.DisplayName() + " | " + ld.DriverName())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user