<!DOCTYPE html>
<html lang="es" dir="ltr">
<head>
<base href="../../../../../">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Servicio SFWidgets.PopupMenu</title>
<link rel="shortcut icon" href="media/navigation/favicon.ico">
<link type="text/css" href="normalize.css" rel="Stylesheet">
<link type="text/css" href="prism.css" rel="Stylesheet">
<link type="text/css" href="default.css" rel="Stylesheet">
<script type="text/javascript" src="polyfills.js"></script><script type="text/javascript" src="languages.js"></script><script type="text/javascript" src="es/langnames.js"></script><script type="text/javascript" src="flexsearch.debug.js"></script><script type="text/javascript" src="prism.js"></script><script type="text/javascript" src="help2.js" defer></script><script type="text/javascript" src="a11y-toggle.js" defer></script><script type="text/javascript" src="paginathing.js" defer></script><script type="text/javascript" src="es/bookmarks.js" defer></script><script type="text/javascript" src="es/contents.js" defer></script><script type="text/javascript" src="help.js" defer></script><meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<header id="TopLeftHeader"><a class="symbol" href="es/text/shared/05/new_help.html"><div></div></a><a class="logo" href="es/text/shared/05/new_help.html"><p dir="auto">Ayuda de LibreOffice 25.2</p></a><div class="dropdowns"><div class="modules">
<button type="button" data-a11y-toggle="modules-nav" id="modules" aria-haspopup="true" aria-expanded="false" aria-controls="modules-nav">Módulo</button><nav id="modules-nav" hidden=""></nav>
</div></div></header><aside class="leftside"><input id="accordion-1" name="accordion-menu" type="checkbox"><label for="accordion-1" dir="auto">Contenido</label><div id="Contents" class="contents-treeview"></div></aside><div id="SearchFrame"><div id="Bookmarks">
<input id="search-bar" type="search" class="search" placeholder="Buscar en los marcadores del módulo elegido" dir="auto"><div class="nav-container" tabindex="0"><nav class="index" dir="auto"></nav></div>
</div></div>
<div id="DisplayArea" itemprop="softwareHelp" itemscope="true" itemtype="http://schema.org/SoftwareApplication">
<noscript><div id="WarnJS"><h1 dir="auto">Active JavaScript en el navegador para mostrar las páginas de ayuda de LibreOffice.</h1></div></noscript>
<a id="ScriptForge-sf_popupmenu"></a>
<a id="bm_id501600788076877"></a>
<meta itemprop="keywords" content="PopupMenu service">
<a id="abstract"></a>
<h1 id="bm_id681600788076499" dir="auto">
<a id="PopupMenuService"></a><span class="literal">SFWidgets</span>.<span class="literal">PopupMenu</span> service</h1>
<p id="par_id181600788076612" class="paragraph" dir="auto">The <span class="literal">PopupMenu</span> service can be used to create popup menus that can be associated with events or executed by scripts. This service provides the following capabilities:</p>
<ul itemprop="Unordered" itemscope="true" itemtype="http://schema.org/ItemList" dir="auto">
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id301600788076785" class="listitem" dir="auto">Creation of popup menus with custom entries, checkboxes and radio buttons.</p>
</li>
<li itemprop="itemListElement" itemscope="true" itemtype="http://schema.org/ItemListUnordered" dir="auto">
<p id="par_id1001600788076848" class="listitem" dir="auto">Decoration of menu items with icons and tooltips.</p>
</li>
</ul>
<h2 id="hd_id281600788076359" dir="auto">Invocación del servicio</h2>
<p id="par_id141609955500101" class="paragraph" dir="auto">Antes de utilizar el servicio <span class="literal">PopupMenu</span>, es necesario cargar o importar la biblioteca <span class="literal">ScriptForge</span>:</p>
<div class="embedded">
<a id="importLibs"></a>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id901528999850603" dir="auto">• Para cargar la biblioteca <span class="literal">ScriptForge</span> que necesitan las macros de Basic se debe usar la siguiente declaración:<br><span class="literal">GlobalScope.BasicLibraries.loadLibrary("ScriptForge")</span><br><br>• Los scripts de Python necesitan importar el módulo <span class="literal">scriptforge</span>:<br><span class="literal">from scriptforge import CreateScriptService</span></p></div>
</div>
<br>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<p id="par_id321614902851541" class="paragraph" dir="auto">The <span class="literal">PopupMenu</span> service can be instantiated in multiple ways. The example below creates a popup menu without associating it with a mouse or application event.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Sub ShowPopup
GlobalScope.BasicLibraries.loadLibrary("ScriptForge")
Dim myPopup As Object
Set myPopup = CreateScriptService("SFWidgets.PopupMenu", , 300, 300)
myPopup.AddItem("Item ~A")
myPopup.AddItem("Item ~B")
vResponse = myPopup.Execute()
MsgBox("Selected item ID: " & vResponse)
myPopup.Dispose()
End Sub
</code></pre></div>
<p id="par_id341636718182262" class="paragraph" dir="auto">Running the <span class="literal">Sub</span> defined above will create a popup menu with two entries in the position X=300 and Y=300 on the screen.</p>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id711636493696169" dir="auto">The prefix <span class="literal">SFWidgets</span> can be suppressed while invoking the <span class="literal">PopupMenu</span> service.</p></div>
</div>
<br>
<p id="par_id851635274721129" class="paragraph" dir="auto">The following example defines a <span class="literal">Sub</span> that can be associated with a mouse event:</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Sub MyPopupClick(Optional poMouseEvent as Object)
Dim myPopup As Object
Set myPopup = CreateScriptService("PopupMenu", poMouseEvent)
' Populate popupmenu with items
Dim vResponse As Variant
vResponse = myPopup.Execute(False)
' Do something based on vResponse
' ...
myPopup.Dispose()
End Sub
</code></pre></div>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id991636718278125" dir="auto">Use the <span class="literal">Dispose</span> method to free resources after executing the popup menu.</p></div>
</div>
<br>
<p id="par_id531636493797707" class="paragraph" dir="auto">It is also possible to associate a popup menu with events triggered by LibreOffice applications, form and dialog controls. Events such as "Mouse button pressed" and "Mouse button released" are commonly associated with popup menus.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
Sub MyPopupClick(Optional poEvent as Object)
Dim myPopup As Object
Set myPopup = CreateScriptService("PopupMenu", poEvent)
' ...
End Sub
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<p id="par_id131635275172617" class="paragraph" dir="auto">Los ejemplos anteriores pueden escribirse en Python de esta manera:</p>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
from scriptforge import CreateScriptService
def show_popup(args=None):
my_popup = CreateScriptService("SFWidgets.PopupMenu", None, 300, 300)
bas = CreateScriptService("Basic")
my_popup.AddItem("Item ~A")
my_popup.AddItem("Item ~B")
response = my_popup.Execute()
bas.MsgBox(f"Selected item ID: {response}")
my_popup.Dispose()
</code></pre></div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
def my_popup_click(poEvent=None):
my_popup = CreateScriptService("SFWidgets.PopupMenu", poEvent)
# Populate popupmenu with items
response = my_popup.Execute()
# Hacer algo en función de una respuesta
my_popup.Dispose()
</code></pre></div>
<a id="bm_id111614901520029"></a>
<meta itemprop="keywords" content="PopupService service,ShortcutCharacter">
<meta itemprop="keywords" content="PopupService service,SubmenuCharacter">
<h2 id="hd_id711600788076834" dir="auto">Propiedades</h2>
<a id="properties_toc"></a>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id461600788076917" class="tableheadintable" dir="auto">Nombre</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id221600788076591" class="tableheadintable" dir="auto">De solo lectura</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id761600788076328" class="tableheadintable" dir="auto">Tipo</p>
</th>
<th rowspan="" colspan="" class="tableheadcell" dir="auto">
<p id="par_id67160078807636" class="tableheadintable" dir="auto">Descripción</p>
</th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id941600788076595" class="tablecontentintable" dir="auto">ShortcutCharacter</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id49160078807654" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id961600788076376" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id81600788076419" class="tablecontentintable" dir="auto">Character used to define the access key of a menu item. The default character is <span class="literal">~</span>.</p>
</td>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id491600788076621" class="tablecontentintable" dir="auto">SubmenuCharacter</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id311600788076756" class="tablecontentintable" dir="auto">No</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id831600788076785" class="tablecontentintable" dir="auto">String</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id441600788076826" class="tablecontentintable" dir="auto">Character or string that defines how menu items are nested. The default character is <span class="literal">></span>.</p>
</td>
</tr>
</table>
<br>
<h2 id="hd_id181636719707892" dir="auto">Menús y submenús</h2>
<p id="par_id741636719725402" class="paragraph" dir="auto">To create a popup menu with submenus, use the character defined in the <span class="literal">SubmenuCharacter</span> property while creating the menu entry to define where it will be placed. For instance, consider the following menu/submenu hierarchy.</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
' Item A
' Item B > Item B.1
' Item B.2
' ------ (line separator)
' Item C > Item C.1 > Item C.1.1
' Item C.1.2
' Item C > Item C.2 > Item C.2.1
' Item C.2.2
' ------ (line separator)
' Item C.2.3
' Item C.2.4
</code></pre></div>
<p id="par_id211636720111489" class="paragraph" dir="auto">The code below uses the default submenu character <span class="literal">></span> to create the menu/submenu hierarchy defined above:</p>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
myPopup.AddItem("Item A")
myPopup.AddItem("Item B>Item B.1")
myPopup.AddItem("Item B>Item B.2")
myPopup.AddItem("---")
myPopup.AddItem("Item C>Item C.1>Item C.1.1")
myPopup.AddItem("Item C>Item C.1>Item C.1.2")
myPopup.AddItem("Item C>Item C.2>Item C.2.1")
myPopup.AddItem("Item C>Item C.2>Item C.2.2")
myPopup.AddItem("Item C>Item C.2>---")
myPopup.AddItem("Item C>Item C.2>Item C.2.3")
myPopup.AddItem("Item C>Item C.2>Item C.2.4")
</code></pre></div>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id121636721243578" dir="auto">La cadena <span class="literal">---</span> se utiliza para definir líneas separadoras en los menús y submenús.</p></div>
</div>
<br>
<a id="using_icons"></a>
<h2 id="hd_id211636723438558" dir="auto">Utilizar iconos</h2>
<p id="par_id981636723485402" class="paragraph" dir="auto">Items in the menu can have icons, which are specified as arguments in the <span class="literal">AddCheckBox</span>, <span class="literal">AddItem</span> and <span class="literal">AddRadioButton</span> methods.</p>
<p id="par_id881636724112434" class="paragraph" dir="auto">Todos los iconos disponibles en LibreOffice pueden utilizarse especificando su ruta relativa a la carpeta donde se encuentran los archivos de iconos en la carpeta de instalación. Los iconos se encuentran en la siguiente carpeta:</p>
<p id="par_id991636724479899" class="paragraph" dir="auto"><span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">INSTALLDIR/share/config</span></p>
<div class="tip">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/tip.svg" alt="tip" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id941636724808906" dir="auto">Utilice la propiedad <span class="literal">InstallFolder</span> del servicio <span class="literal">FileSystem</span> para determinar dónde está instalado LibreOffice en su sistema.</p></div>
</div>
<br>
<p id="par_id201636724575911" class="paragraph" dir="auto">This folder contains a series of ZIP files containing the image files of each available icon set. The images inside these ZIP files are organized into folders. To use an icon, specify the icon file with the path to its location inside the ZIP file.</p>
<p id="par_id641636724972071" class="paragraph" dir="auto">The example below uses the icon "sc_newdoc.svg" that is located inside the "cmd" folder. The forward slash "/" character is used as the path separator regardless of the operating system.</p>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
myMenu.AddItem("Item A", Icon := "cmd/sc_newdoc.svg")
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
myMenu.AddItem("Item A", icon="cmd/sc_newdoc.svg")
</code></pre></div>
<div class="note">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/note.svg" alt="note" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id691636725233961" dir="auto">Todos los conjuntos de iconos tienen la misma estructura interna. El icono mostrado depende del conjunto de iconos en uso actualmente.</p></div>
</div>
<br>
<h2 id="hd_id501582887473754" dir="auto">Métodos</h2>
<a id="methods_toc"></a>
<table border="1" class="" cellpadding="0" cellspacing="0">
<tr>
<th rowspan="" colspan="3" class="tableheadcell" dir="auto">
<p id="par_id891611613601554" class="tableheadintable" dir="auto">Lista de métodos en el servicio PopupMenu</p>
</th>
</tr>
<tr>
<td rowspan="" colspan="" dir="auto">
<p id="par_id891611613601556" class="tablecontentintable" dir="auto">
<a target="_top" href="es/text/sbasic/shared/03/sf_popupmenu.html#AddCheckBox">AddCheckBox</a><br>
<a target="_top" href="es/text/sbasic/shared/03/sf_popupmenu.html#AddItem">AddItem</a>
</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id541611613601554" class="tablecontentintable" dir="auto">
<a target="_top" href="es/text/sbasic/shared/03/sf_popupmenu.html#AddRadioButton">AddRadioButton</a><br><br>
</p>
</td>
<td rowspan="" colspan="" dir="auto">
<p id="par_id541611613625804" class="tablecontentintable" dir="auto">
<a target="_top" href="es/text/sbasic/shared/03/sf_popupmenu.html#Execute">Execute</a><br><br>
</p>
</td>
</tr>
</table>
<br>
<a id="AddCheckBox"></a>
<a id="bm_id92158919969883"></a>
<meta itemprop="keywords" content="PopupMenu service,AddCheckBox">
<h2 id="hd_id201589199698251" dir="auto">AddCheckBox</h2>
<p id="par_id93158919969864" class="paragraph" dir="auto">Inserta una casilla en el menú emergente. Devuelve un valor entero que identifica el elemento insertado.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id821621534014732" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.AddCheckBox(menuitem: str, opt name: str, opt status: bool = False, opt icon: str, opt tooltip: str): int</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id821591631203996" class="paragraph" dir="auto"><span class="emph">menuitem:</span> Defines the text to be displayed in the menu. This argument also defines the hierarchy of the item inside the menu by using the submenu character.</p>
<p id="par_id821591631203116" class="paragraph" dir="auto"><span class="emph">name:</span> String value to be returned when the item is clicked. By default, the last component of the menu hierarchy is used.</p>
<p id="par_id821591631203133" class="paragraph" dir="auto"><span class="emph">status:</span> Defines whether the item is selected when the menu is created (Default = <span class="literal">False</span>).</p>
<p id="par_id11636721653313" class="paragraph" dir="auto"><span class="emph">icon:</span> Path and name of the icon to be displayed without the leading path separator. The actual icon shown depends on the icon set being used.</p>
<p id="par_id11636721653208" class="paragraph" dir="auto"><span class="emph">tooltip:</span> Text to be displayed as tooltip.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
myPopup.AddCheckBox("Option A", Status := True)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
my_popup.AddCheckBox("Option A", status=True)
</code></pre></div>
<a id="AddItem"></a>
<a id="bm_id92158919960353"></a>
<meta itemprop="keywords" content="PopupMenu service,AddItem">
<h2 id="hd_id201589199698158" dir="auto">AddItem</h2>
<p id="par_id93158919963364" class="paragraph" dir="auto">Inserts a menu entry in the popup menu. Returns an integer value that identifies the inserted item.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id821621534012185" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.AddItem(menuitem: str, opt name: str, opt icon: str, opt tooltip: str): int</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id821591631203021" class="paragraph" dir="auto"><span class="emph">menuitem:</span> Defines the text to be displayed in the menu. This argument also defines the hierarchy of the item inside the menu by using the submenu character.</p>
<p id="par_id821591631203026" class="paragraph" dir="auto"><span class="emph">name:</span> String value to be returned when the item is clicked. By default, the last component of the menu hierarchy is used.</p>
<p id="par_id11636721652886" class="paragraph" dir="auto"><span class="emph">icon:</span> Path and name of the icon to be displayed without the leading path separator. The actual icon shown depends on the icon set being used.</p>
<p id="par_id11636721653118" class="paragraph" dir="auto"><span class="emph">tooltip:</span> Text to be displayed as tooltip.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
myPopup.AddItem("Item A", Tooltip := "Un mensaje descriptivo")
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
my_popup.AddItem("Item A", tooltip = "A descriptive message")
</code></pre></div>
<a id="AddRadioButton"></a>
<a id="bm_id92158919969447"></a>
<meta itemprop="keywords" content="PopupMenu service,AddRadioButton">
<h2 id="hd_id201589199693022" dir="auto">AddRadioButton</h2>
<p id="par_id93158919969399" class="paragraph" dir="auto">Inserta una entrada de botón de opción en el menú emergente. Devuelve un valor entero que identifica el elemento insertado.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id821621534013775" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.AddRadioButton(menuitem: str, opt name: str, opt status: bool = False, opt icon: str, opt tooltip: str): int</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id821591631203501" class="paragraph" dir="auto"><span class="emph">menuitem:</span> Defines the text to be displayed in the menu. This argument also defines the hierarchy of the item inside the menu by using the submenu character.</p>
<p id="par_id821591631228716" class="paragraph" dir="auto"><span class="emph">name:</span> String value to be returned when the item is clicked. By default, the last component of the menu hierarchy is used.</p>
<p id="par_id821591631203643" class="paragraph" dir="auto"><span class="emph">status:</span> Defines whether the item is selected when the menu is created (Default = <span class="literal">False</span>).</p>
<p id="par_id11636721653228" class="paragraph" dir="auto"><span class="emph">icon:</span> Path and name of the icon to be displayed without the leading path separator. The actual icon shown depends on the icon set being used.</p>
<p id="par_id11636721653114" class="paragraph" dir="auto"><span class="emph">tooltip:</span> Text to be displayed as tooltip.</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
myPopup.AddRadioButton("Option A", Name := "A", Status := True)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
my_popup.AddRadioButton("Option A", name="A", status=True)
</code></pre></div>
<a id="Execute"></a>
<a id="bm_id92158919962887"></a>
<meta itemprop="keywords" content="PopupMenu service,Execute">
<h2 id="hd_id201589199693201" dir="auto">Execute</h2>
<p id="par_id93158919963279" class="paragraph" dir="auto">Muestra el menú emergente y espera alguna acción por parte del usuario. Devuelve el elemento en que se ha pulsado.</p>
<p id="par_id101636726249788" class="paragraph" dir="auto">If the user clicks outside the popup menu or presses the <span class="keycode">Esc</span> key, then no item is selected. In such cases, the returned value depends on the <span class="literal">returnid</span> parameter. If <span class="literal">returnid = True</span> and no item is selected, then the value 0 (zero) is returned. Otherwise an empty string "" is returned.</p>
<div class="embedded">
<a id="functsyntax"></a>
<h3 id="hd_id061420171139089682" dir="auto">Sintaxis:</h3>
</div>
<p id="par_id821621534014414" class="paragraph" dir="auto">
<span class="input" data-tooltip="Pulse en el texto para copiarlo en el portapapeles">svc.Execute(opt returnid: bool = True): any</span>
</p>
<div class="embedded">
<a id="functparameters"></a>
<h3 id="hd_id061420171139084157" dir="auto">Parámetros:</h3>
</div>
<p id="par_id821591631202088" class="paragraph" dir="auto"><span class="emph">returnid:</span> If <span class="literal">True</span> the selected item ID is returned. If <span class="literal">False</span> the method returns the item's name (Default = <span class="literal">True</span>).</p>
<div class="embedded">
<a id="functexample"></a>
<h3 id="hd_id061420171139088233" dir="auto">Ejemplo:</h3>
</div>
<p id="par_id51636726671698" class="paragraph" dir="auto">In the examples below, a popup menu is created and the item's name is returned because the <span class="literal">returnid</span> argument is set to <span class="literal">False</span>.</p>
<div class="embedded">
<a id="In_Basic"></a>
<h5 id="hd_id191620312698501" dir="auto">En BASIC</h5>
</div>
<div class="bascode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-visual-basic line-numbers">
myPopup.AddItem("Item A", Name := "A")
myPopup.AddItem("Item B", Name := "B")
Dim vResponse as Variant
vResponse = myPopup.Execute(False)
</code></pre></div>
<div class="embedded">
<a id="In_Python"></a>
<h5 id="hd_id831620312769993" dir="auto">En Python</h5>
</div>
<div class="pycode" itemscope="true" itemtype="http://schema.org/SoftwareSourceCode" itemprop="codeSampleType" content="snippet" data-tooltip="Pulse en el texto para copiarlo en el portapapeles"><pre dir="auto"><code class="language-python line-numbers">
my_popup.AddItem("Item A", name="A")
my_popup.AddItem("Item B", name="B")
response = my_popup.Execute(False)
</code></pre></div>
<div class="embedded">
<a id="SF_InternalUse"></a>
<div class="warning">
<div class="noteicon" dir="auto"><img src="media/icon-themes/res/helpimg/warning.svg" alt="warning" style="width:40px;height:40px;"></div>
<div class="notetext"><p id="par_id851506659675843" dir="auto">Todas las rutinas o identificadores BASIC de <span class="literal">ScriptForge</span> precedidas por guion bajo «_» están reservadas para uso interno. No deben utilizarse en macros BASIC o secuencias Python.</p></div>
</div>
<br>
</div>
<a id="relatedtopics"></a><div class="relatedtopics">
<p class="related" itemprop="mentions" dir="auto"><a id="related"></a><span class="emph">Temas relacionados</span></p>
<div class="relatedbody" itemprop="mentions">
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03/sf_dialog.html"><span class="literal">SFDialogs</span>.<span class="literal">Dialog</span> service</a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03/sf_dialogcontrol.html"><span class="literal">SFDialogs</span>.<span class="literal">DialogControl</span> service</a></p></div>
<div class="embedded"><p class="embedded" dir="auto"><a target="_top" href="es/text/sbasic/shared/03/sf_menu.html"><span class="literal">SFWidgets</span>.<span class="literal">Menu</span> service</a></p></div>
</div>
</div>
</div>
<div id="DonationFrame"></div>
<footer><h2 style="text-align: center;"><a href="https://books.libreoffice.org" target="_blank">Libros de LibreOffice</a></h2>
<div class="noteicon" dir="auto" style="display:flex;justify-content:center;flex-wrap:wrap;row-gap:15px;">
<img src="media/navigation/libo-writer.svg" alt="Writer Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-calc.svg" alt="Calc Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-impress.svg" alt="Impress Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-draw.svg" alt="Draw Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-base.svg" alt="Base Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-math.svg" alt="Math Icon" style="width:60px;height:60px;"><img src="media/navigation/libo-symbol-black.svg" alt="Getting Started Icon" style="width:60px;height:60px;">
</div>
<div id="DEBUG" class="debug">
<h3 class="bug">Help content debug info:</h3>
<p dir="auto">This page is: <a href="https://opengrok.libreoffice.org/xref/help/source/text/sbasic/shared/03/sf_popupmenu.xhp" target="_blank">/text/sbasic/shared/03/sf_popupmenu.xhp</a></p>
<p dir="auto">Title is: Servicio SFWidgets.PopupMenu</p>
<p id="bm_module" dir="auto"></p>
<p id="bm_system" dir="auto"></p>
<p id="bm_HID" dir="auto"></p>
</div></footer>
</body>
</html>