gui: add helper function for menu separators
This commit is contained in:
parent
d2b9618da0
commit
471737f421
4
main.go
4
main.go
@ -105,9 +105,7 @@ func (f *TMainForm) OnFormCreate(sender vcl.IObject) {
|
||||
|
||||
//
|
||||
|
||||
mnuSep := vcl.NewMenuItem(mnuFile)
|
||||
mnuSep.SetCaption("-") // Creates separator
|
||||
mnuFile.Add(mnuSep)
|
||||
vcl_menuseparator(mnuFile)
|
||||
|
||||
mnuFileExit := vcl.NewMenuItem(mnuFile)
|
||||
mnuFileExit.SetCaption("Exit")
|
||||
|
17
util_vcl.go
17
util_vcl.go
@ -30,9 +30,22 @@ func vcl_row(owner vcl.IWinControl, top int32) *vcl.TPanel {
|
||||
func vcl_menuitem(parent *vcl.TMenuItem, caption string, imageIndex int32, onClick vcl.TNotifyEvent) *vcl.TMenuItem {
|
||||
m := vcl.NewMenuItem(parent)
|
||||
m.SetCaption(caption)
|
||||
m.SetImageIndex(imageIndex)
|
||||
m.SetOnClick(onClick)
|
||||
if imageIndex != -1 {
|
||||
m.SetImageIndex(imageIndex)
|
||||
}
|
||||
if onClick != nil {
|
||||
m.SetOnClick(onClick)
|
||||
}
|
||||
parent.Add(m)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// vcl_menuseparator adds a separator to the parent TMenuItem.
|
||||
func vcl_menuseparator(parent *vcl.TMenuItem) *vcl.TMenuItem {
|
||||
s := vcl.NewMenuItem(parent)
|
||||
s.SetCaption("-") // Creates separator
|
||||
parent.Add(s)
|
||||
|
||||
return s
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user