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

坚强是说给别人听的谎言 提交于 2020-01-15 09:32:11

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!