gui: add exit menu item

This commit is contained in:
mappu 2024-06-08 13:34:49 +12:00
parent f913b63c58
commit cb4b35b059

13
main.go
View File

@ -47,6 +47,15 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
mnuFileOpen.SetOnClick(f.OnMnuFileOpenClick)
mnuFile.Add(mnuFileOpen)
mnuSep := vcl.NewMenuItem(mnuFile)
mnuSep.SetCaption("-") // Creates separator
mnuFile.Add(mnuSep)
mnuFileExit := vcl.NewMenuItem(mnuFile)
mnuFileExit.SetCaption("Exit")
mnuFileExit.SetOnClick(f.OnMnuFileExitClick)
mnuFile.Add(mnuFileExit)
f.Menu = vcl.NewMainMenu(f)
f.Menu.Items().Add(mnuFile)
@ -110,6 +119,10 @@ func (f *TMainForm) OnMnuFileOpenClick(sender vcl.IObject) {
}
}
func (f *TMainForm) OnMnuFileExitClick(sender vcl.IObject) {
os.Exit(0)
}
func (f *TMainForm) OnNavChange(sender vcl.IObject, node *vcl.TTreeNode) {
if node.Data() == nil {