SOLFIND
Web Lens
Portal home

Menu | Electron

https://www.electronjs.org/es/docs/latest/api/menu • 46 KB fetched
Open original page


Menu | Electron Saltar al contenido principal Electron Documentación API Blog Herramientas * Electron Forge * Electron Fiddle Comunidad * Gobernanza * Muestra * Recursos Lanzamientos Español * English * Deutsch * Español * Français * 日本語 * Português * Русский * 中文 Búsqueda * Módulos del proceso principal * app * autoUpdater * BaseWindow * BrowserView * Deprecated * BrowserWindow * clipboard * contentTracing * crashReporter * desktopCapturer * dialog * acceso rápido global * ImageView * Compras integradas * ipcMain * Menu * MenuItem * MessageChannelMain * Título 1 Xpath:/h 1 * nativeImage * nativeTheme * net * netLog * Notification * powerMonitor * powerSaveBlocker * process * protocol * pushNotifications * safeStorage * screen * session * sharedTexture * ShareMenu * shell * systemPreferences * Barra táctil * Tray * utilityProcess * webContents * WebContentsView * webFrameMain * Vista * Módulos de Process Renderer * Utility Process Modules * Elementos de DOM personalizados * Chromium y Node.js * Clases * Estructuras del API * * Módulos del proceso principal * Menu En esta página Menu Clase: Menú ​ Create application menus and context menus. Proceso: principal The presentation of menus varies depending on the operating system: * Under Windows and Linux, menus are visually similar to Chromium. * Under macOS, these will be native menus. [!TIP] See also: A detailed guide about how to implement menus in your application . [!WARNING] Electron's built-in classes cannot be subclassed in user code. For more information, see the FAQ . new Menu() ​ Crea un nuevo menú. Métodos Estáticos ​ La clase Menu tiene los siguientes métodos estáticos: Menu.setApplicationMenu(menu) ​ * menu Menu | null Establece menu como el menú de la aplicación en macOS. En Windows y Linux el menu será establecido como el menú superior de la ventana. Además en Windows y Linux, puedes usar un & en el nombre del ítem de nivel superior para indicar que letra debe obtener un acelerador generado. Por ejemplo, usando &File para el menú resultaría en un acelerador generado Alt-F que abre el menú asociado. El carácter indicado en la etiqueta del botón entonces aparecerá subrayado, y el carácter & no se mostrará en la etiqueta del botón. In order to escape the & character in an item name, add a preceding & . Por ejemplo, &&Archivo abrirá &Archivo en la etiqueta del botón. Passing null will suppress the default menu. On Windows and Linux, this has the additional effect of removing the menu bar from the window. [!NOTE] The default menu will be created automatically if the app does not set one. It contains standard items such as File , Edit , View , and Window . Menu.getApplicationMenu() ​ Devuelve Menu | null - El menú de aplicación, si se creó, o null en caso contrario. [!NOTE] The returned Menu instance doesn't support dynamic addition or removal of menu items. Instance properties can still be dynamically modified. Menu.sendActionToFirstResponder(action) macOS ​ * action string Envía la action al primer respondedor de la aplicación. Esto es usado para emular los comportamientos del menú macOS por defecto. Usually you would use the role property of a MenuItem . See the macOS Cocoa Event Handling Guide for more information on macOS' native actions. Menu.buildFromTemplate(template) ​ * template ( MenuItemConstructorOptions | MenuItem )[] Returns Menu Generally, the template is an array of options for constructing a MenuItem . The usage can be referenced above. Usted puede además adjuntar otros campos al elemento del template y se convierten en propiedades de los items del menú construido. Métodos de Instancia ​ El objeto menu tiene los siguientes métodos de instancia: menu.popup([options]) ​ * options Object (opcional) * window BaseWindow (optional) - Default is the focused window. * frame WebFrameMain (optional) - Provide the relevant frame if you want certain OS-level features such as Writing Tools on macOS to function correctly. Typically, this should be params.frame from the context-menu event on a WebContents, or the focusedFrame property of a WebContents. * x número (opcional) - Default es la posición actual del cursor. Debe ser declarado si y es declarado. * y número (opcional) - Default es la posición actual del cursor. Debe ser declarado si x es declarado. * positioningItem número (opcional) macOS - El índice del elemento del menú que debe ser posicionado debajo del cursor en las coordenadas específicas. El valor predeterminado es -1. * sourceType string (optional) Windows Linux - This should map to the menuSourceType provided by the context-menu event. It is not recommended to set this value manually, only provide values you receive from other APIs or leave it undefined . Puede ser none , mouse , keyboard , touch , touchMenu , longPress , longTap , touchHandle , stylus , adjustSelection , o adjustSelectionReset . * callback Function (opcional) - Llamada cuando se cierra el menu. Pops up this menu as a context menu in the BaseWindow . [!TIP] For more details, see the Context Menu guide. menu.closePopup([window]) ​ * window BaseWindow (optional) - Default is the focused window. Closes the context menu in the window . menu.append(menuItem) ​ * menuItem MenuItem Anexa el menuItem al menú. menu.getMenuItemById(id) ​ * id string Returns MenuItem | null - the item with the specified id menu.insert(pos, menuItem) ​ * pos Entero * menuItem MenuItem Inserta el menuItem en la posición pos del menú. Eventos de Instancia ​ Objetos creados con new Menu o retornados por Menu.buildFromTemplate emiten los siguientes eventos: [!NOTE] Some events are only available on specific operating systems and are labeled as such. Evento: 'menu-will-show' ​ Devuelve: * event Event Emitido cuando se llama a menu.popup() . Evento: 'menu-will-close' ​ Devuelve: * event Event Se emite cuando una ventana emergente se cierra manualmente o con menu.closePopup() . Propiedades de la instancia ​ Los objetos menu también tienen las siguientes propiedades: menu.items ​ A MenuItem[] array containing the menu's items. Each Menu consists of multiple MenuItem instances and each MenuItem can nest a Menu into its submenu property. Editar esta página Anterior ipcMain Siguiente MenuItem * Clase: Menú * new Menu() * Métodos Estáticos * setApplicationMenu * getApplicationMenu * sendActionToFirstResponder * buildFromTemplate * Métodos de Instancia * popup * closePopup * append * getMenuItemById * insert * Eventos de Instancia * Evento: 'menu-will-show' * Evento: 'menu-will-close' * Propiedades de la instancia * items Documentación * Empezar * Referencia de la API Listas de verificación * Rendimiento * Seguridad Herramientas * Electron Forge * Electron Fiddle Comunidad * Gobernanza * Recursos * Discord * Bluesky * X * Mastodon * Stack Overflow Más * GitHub * Open Collective * Infraestructura de Pizarra Hosting and infrastructure graciously provided by

Links found on this page

  1. Saltar al contenido principal [direct]
  2. Electron [direct]
  3. Documentación [direct]
  4. API [direct]
  5. Blog [direct]
  6. Electron Forge [direct]
  7. Electron Fiddle [direct]
  8. Gobernanza [direct]
  9. Muestra [direct]
  10. Recursos [direct]
  11. Lanzamientos [direct]
  12. English [direct]
  13. Deutsch [direct]
  14. Français [direct]
  15. 日本語 [direct]
  16. Português [direct]
  17. Русский [direct]
  18. 中文 [direct]
  19. autoUpdater [direct]
  20. BaseWindow [direct]
  21. BrowserView Deprecated [direct]
  22. BrowserWindow [direct]
  23. clipboard [direct]
  24. contentTracing [direct]
  25. crashReporter [direct]
  26. desktopCapturer [direct]
  27. dialog [direct]
  28. acceso rápido global [direct]
  29. ImageView [direct]
  30. Compras integradas [direct]
  31. ipcMain [direct]
  32. MenuItem [direct]
  33. MessageChannelMain [direct]
  34. Título 1 Xpath:/h 1 [direct]
  35. nativeImage [direct]
  36. nativeTheme [direct]
  37. net [direct]
  38. netLog [direct]
  39. Notification [direct]
  40. powerMonitor [direct]
  41. powerSaveBlocker [direct]
  42. process [direct]
  43. protocol [direct]
  44. pushNotifications [direct]
  45. safeStorage [direct]
  46. screen [direct]
  47. session [direct]
  48. sharedTexture [direct]
  49. ShareMenu [direct]
  50. shell [direct]
  51. systemPreferences [direct]
  52. Barra táctil [direct]
  53. Tray [direct]
  54. utilityProcess [direct]
  55. webContents [direct]
  56. WebContentsView [direct]
  57. webFrameMain [direct]
  58. Vista [direct]
  59. Elementos de DOM personalizados [direct]
  60. Chromium y Node.js [direct]
  61. Clases [direct]
  62. Estructuras del API [direct]
  63. principal [direct]
  64. A detailed guide about how to implement menus in your application [direct]
  65. the FAQ [direct]
  66. macOS Cocoa Event Handling Guide [direct]
  67. Context Menu [direct]
  68. Editar esta página [direct]
  69. Rendimiento [direct]
  70. Seguridad [direct]
  71. Discord [direct]
  72. Bluesky [direct]
  73. X [direct]
  74. Mastodon [direct]
  75. Stack Overflow [direct]
  76. GitHub [direct]
  77. Open Collective [direct]
  78. Infraestructura de Pizarra [direct]