问题
How do I hide "Preferences" item in this picture when "undo and redo" items are able to hide? I tried using (preferences:hide-dialog) but there was no difference in GUI.
#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)
;hiding items in edit menu
(define/override (edit-menu:create-undo?) #f)
(define/override (edit-menu:create-redo?) #f)
(super-new)))
(define top-frame
(new menu-frame%
[label "Main Window"]
[width 200]
[height 200]
[alignment (list 'left 'top)]))
回答1:
Use
(define/override (edit-menu:create-preferences?) #f)
Note: I haven't tested that it works, but digging in the code shows that the following are defined:
file-menu:create-new?
file-menu:create-open?
file-menu:create-open-recent?
file-menu:create-revert?
file-menu:create-save?
file-menu:create-save-as?
file-menu:create-print?
edit-menu:create-undo?
edit-menu:create-redo?
edit-menu:create-cut?
edit-menu:create-paste?
edit-menu:create-clear?
edit-menu:create-find?
edit-menu:create-preferences?
来源:https://stackoverflow.com/questions/38119680/cant-hide-preferences-item-in-edit-menu