{"id":7406,"date":"2022-12-20T19:37:58","date_gmt":"2022-12-20T22:37:58","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/cursesuimenubar-man3\/"},"modified":"2022-12-20T19:37:58","modified_gmt":"2022-12-20T22:37:58","slug":"cursesuimenubar-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/cursesuimenubar-man3\/","title":{"rendered":"Curses::UI::Menubar (man3)"},"content":{"rendered":"<h1 align=\"center\">Curses::UI::Menubar<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#CLASS HIERARCHY\">CLASS HIERARCHY<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#STANDARD OPTIONS\">STANDARD OPTIONS<\/a><br \/> <a href=\"#WIDGET-SPECIFIC OPTIONS\">WIDGET-SPECIFIC OPTIONS<\/a><br \/> <a href=\"#METHODS\">METHODS<\/a><br \/> <a href=\"#DEFAULT BINDINGS\">DEFAULT BINDINGS<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#AUTHOR\">AUTHOR<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Curses::UI::Menubar \u2212 Create and manipulate menubar widgets<\/p>\n<h2>CLASS HIERARCHY <a name=\"CLASS HIERARCHY\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Curses::UI::Widget <br \/> | <br \/> +\u2212\u2212\u2212\u2212Curses::UI::Container <br \/> | <br \/> +\u2212\u2212\u2212\u2212Curses::UI::Window <br \/> | <br \/> +\u2212\u2212\u2212\u2212Curses::UI::Menubar<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">use Curses::UI; <br \/> my $cui = new Curses::UI; <br \/> # define the menu datastructure. <br \/> my $menu_data = [&#8230;.]; <br \/> my $menu = $cui\u2212>add( <br \/> &#8216;menu&#8217;, &#8216;Menubar&#8217;, <br \/> \u2212menu => $menu_data <br \/> ); <br \/> $menu\u2212>focus();<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This class can be used to add a menubar to Curses::UI. This menubar can contain a complete submenu hierarchy. It looks (remotely :\u2212) like this:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212 <br \/> menu1 | menu2 | menu3 | &#8230;. <br \/> \u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212 <br \/> +\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212+ <br \/> |menuitem 1 | <br \/> |menuitem 2 |+\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212+ <br \/> |menuitem 3 >>||submenuitem 1 | <br \/> |menuitem 4 ||submenuitem 2 | <br \/> +\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212+|submenuitem 3 | <br \/> |submenuitem 4 | <br \/> |submenuitem 5 | <br \/> +\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212\u2212+<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">See exampes\/demo\u2212Curses::UI::Menubar in the distribution for a short demo.<\/p>\n<h2>STANDARD OPTIONS <a name=\"STANDARD OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This class does not use any of the standard options that are provided by Curses::UI::Widget.<\/p>\n<h2>WIDGET-SPECIFIC OPTIONS <a name=\"WIDGET-SPECIFIC OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">There is only one option: <b>\u2212menu<\/b>. The value for this option is an <small>ARRAYREF.<\/small> This <small>ARRAYREF<\/small> behaves exactly like the one that is described in Curses::UI::MenuListbox. The difference is that for the top-level menu, you will only use \u2212submenu\u2019s. Example data structure:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">my $menu1 = [ <br \/> { \u2212label => &#8216;option 1&#8217;, \u2212value => &#8216;1\u22121&#8217; }, <br \/> { \u2212label => &#8216;option 2&#8217;, \u2212value => &#8216;1\u22122&#8217; }, <br \/> { \u2212label => &#8216;option 3&#8217;, \u2212value => &#8216;1\u22123&#8217; }, <br \/> ]; <br \/> my $menu2 = [ <br \/> { \u2212label => &#8216;option 1&#8217;, \u2212value => &#038;sel1 }, <br \/> { \u2212label => &#8216;option 2&#8217;, \u2212value => &#038;sel2 }, <br \/> { \u2212label => &#8216;option 3&#8217;, \u2212value => &#038;sel3 }, <br \/> ]; <br \/> my $submenu = [ <br \/> { \u2212label => &#8216;suboption 1&#8217;, \u2212value => &#8216;3\u22123\u22121&#8217; }, <br \/> { \u2212label => &#8216;suboption 2&#8217;, \u2212callback=> &#038;do_it }, <br \/> ]; <br \/> my $menu3 = [ <br \/> { \u2212label => &#8216;option 1&#8217;, \u2212value => &#038;sel2 }, <br \/> { \u2212label => &#8216;option 2&#8217;, \u2212value => &#038;sel3 }, <br \/> { \u2212label => &#8216;submenu 1&#8217;, \u2212submenu => $submenu }, <br \/> ]; <br \/> my $menu = [ <br \/> { \u2212label => &#8216;menu 1&#8217;, \u2212submenu => $menu1 }, <br \/> { \u2212label => &#8216;menu 2&#8217;, \u2212submenu => $menu2 } <br \/> { \u2212label => &#8216;menu 3&#8217;, \u2212submenu => $menu3 } <br \/> ];<\/p>\n<h2>METHODS <a name=\"METHODS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"25%\">\n<p style=\"margin-top: 1em\"><b>new<\/b> ( <small>OPTIONS<\/small> )<\/p>\n<\/td>\n<td width=\"58%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"25%\">\n<p><b>layout<\/b> ( )<\/p>\n<\/td>\n<td width=\"58%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"25%\">\n<p><b>draw<\/b> ( <small>BOOLEAN<\/small> )<\/p>\n<\/td>\n<td width=\"58%\"> <\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p>\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"25%\">\n<p><b>focus<\/b> ( )<\/p>\n<\/td>\n<td width=\"58%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">These are standard methods. See Curses::UI::Widget for an explanation of these.<\/p>\n<h2>DEFAULT BINDINGS <a name=\"DEFAULT BINDINGS\"><\/a> <\/h2>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"12%\">\n<p style=\"margin-top: 1em\"><<b>escape<\/b>><\/p>\n<\/td>\n<td width=\"71%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">Call the \u2019escape\u2019 routine. This will have the menubar loose its focus and return the value \u2019 <small>ESCAPE<\/small> \u2019 to the calling routine.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"8%\">\n<p style=\"margin-top: 1em\"><<b>tab<\/b>><\/p>\n<\/td>\n<td width=\"75%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">Call the \u2019return\u2019 routine. This will have the menubar loose its focus and return the value \u2019 <small>LOOSE_FOCUS<\/small> \u2019 to the calling routine.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"41%\">\n<p style=\"margin-top: 1em\"><<b>cursor-down<\/b>>, <<b>j<\/b>>, <<b>enter<\/b>><\/p>\n<\/td>\n<td width=\"42%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">Call the \u2019pulldown\u2019 routine. This will open the menulistbox for the current menu and give that menulistbox the focus. What happens after the menulistbox loses its focus, depends upon the returnvalue of it:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">* the value \u2019 <small>CURSOR_LEFT<\/small> \u2019<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Call the &#8216;cursor\u2212left&#8217; routine and after that <br \/> call the &#8216;pulldown&#8217; routine. So this will open <br \/> the menulistbox for the previous menu.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">* the value \u2019 <small>CURSOR_RIGHT<\/small> \u2019<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">Call the &#8216;cursor\u2212right&#8217; routine and after that <br \/> call the &#8216;pulldown&#8217; routine. So this will open <br \/> the menulistbox for the next menu.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">* the value \u2019 <small>LOOSE_FOCUS<\/small> \u2019<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The menubar will keep the focus, but no <br \/> menulistbox will be open.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">* the value \u2019 <small>ESCAPE<\/small> \u2019<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The menubar will loose its focus and return the <br \/> value &#8216;ESCAPE&#8217; to the calling routine.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">* A <small>CODE<\/small> reference<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The code will be excuted, the menubar will loose its <br \/> focus and the returnvalue of the CODE will be <br \/> returned to the calling routine.<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">* Any other value<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">The menubar will loose its focus and the value will <br \/> be returned to the calling routine.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"28%\">\n<p style=\"margin-top: 1em\"><<b>cursor-left<\/b>>, <<b>h<\/b>><\/p>\n<\/td>\n<td width=\"55%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">Call the \u2019cursor\u2212left\u2019 routine. This will select the previous menu. If the first menu is already selected, the last menu will be selected.<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"11%\"><\/td>\n<td width=\"1%\">\n<p style=\"margin-top: 1em\">\u2022<\/p>\n<\/td>\n<td width=\"5%\"><\/td>\n<td width=\"29%\">\n<p style=\"margin-top: 1em\"><<b>cursor-right<\/b>>, <<b>l<\/b>><\/p>\n<\/td>\n<td width=\"54%\"> <\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%; margin-top: 1em\">Call the \u2019cursor\u2212right\u2019 routine. This will select the next menu. If the last menu is already selected, the first menu will be selected.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Curses::UI, Curses::UI::MenuListbox, Curses::UI::Listbox<\/p>\n<h2>AUTHOR <a name=\"AUTHOR\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright (c) 2001\u22122002 Maurice Makaay. All rights reserved.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Maintained by Marcus Thiesen (marcus@cpan.thiesenweb.de)<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This package is free software and is provided &#8220;as is&#8221; without express or implied warranty. It may be used, redistributed and\/or modified under the same terms as perl itself.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  Curses::UI::Menubar \u2212 Create and manipulate menubar widgets <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3719,3007],"class_list":["post-7406","post","type-post","status-publish","format-standard","hentry","category-sin-categoria","tag-cursesuimenubar","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7406","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7406"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7406\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7406"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7406"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7406"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}