隐藏此链接中的菜单项后仍会显示分隔线=> Can't hide "Preferences" item in edit-menu
我搜索了球拍文档,发现只添加了新的分隔符菜单项。 https://docs.racket-lang.org/gui/separator-menu-item_.html 是否可以在空菜单项之间隐藏这些额外的行?
答案 0 :(得分:0)
在“between”方法中创建分隔线。使用void
删除了这些内容。
#lang racket/gui
(require framework)
(define menu-super-frame%
(frame:standard-menus-mixin
frame:basic%))
(define menu-frame%
(class menu-super-frame%
(inherit get-file-menu set-icon)
(define/override (edit-menu:create-undo?) #t)
(define/override (edit-menu:create-redo?) #t)
;; hiding items in edit menu
(define/override (edit-menu:create-cut?) #f)
(define/override (edit-menu:create-copy?) #f)
(define/override (edit-menu:create-paste?) #f)
(define/override (edit-menu:create-clear?) #f)
(define/override (edit-menu:create-select-all?) #f)
(define/override (edit-menu:create-preferences?) #f)
;; remove separator lines
(define/override (edit-menu:between-redo-and-cut edit-menu) (void))
(define/override (edit-menu:between-select-all-and-find edit-menu) (void))
(define/override (edit-menu:between-find-and-preferences edit-menu) (void))
(super-new)))
(define top-frame
(new menu-frame%
[label "Main Window"]
[width 200]
[height 200]
[alignment (list 'left 'top)]))
(send top-frame show #t)