Can't hide “Preferences” item in edit-menu

2019-08-14 20:07发布

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条回答
虎瘦雄心在
2楼-- · 2019-08-14 20:50

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?
查看更多
登录 后发表回答