{"id":5081,"date":"2014-11-25T11:05:54","date_gmt":"2014-11-25T02:05:54","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=5081"},"modified":"2014-11-25T11:05:54","modified_gmt":"2014-11-25T02:05:54","slug":"%e3%83%aa%e3%83%9c%e3%83%b3%e3%83%bb%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%9e%e3%82%a4%e3%82%basplitbutton%e8%a6%81%e7%b4%a0%e3%81%ae%e5%86%85%e5%ae%b9%e3%82%92%e5%8b%95%e7%9a%84%e3%81%ab%e5%a4%89","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=5081","title":{"rendered":"[\u30ea\u30dc\u30f3\u30fb\u30ab\u30b9\u30bf\u30de\u30a4\u30ba]splitButton\u8981\u7d20\u306e\u5185\u5bb9\u3092\u52d5\u7684\u306b\u5909\u66f4\u3059\u308b\u3002"},"content":{"rendered":"<p>3\u5e74\u307b\u3069\u524d\u306b\u66f8\u3044\u305f\u8a18\u4e8b\u300c<a href=\"\/\/www.ka-net.org\/blog\/?p=207\" title=\"menu\u5185\u306b\u3042\u308bbutton\u306e\u6570\u3092\u5897\u3084\u3059\" target=\"_blank\">menu\u5185\u306b\u3042\u308bbutton\u306e\u6570\u3092\u5897\u3084\u3059<\/a>\u300d\u306b\u30b3\u30e1\u30f3\u30c8\u3092\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002<\/p>\n<blockquote><p>\u5897\u3084\u3057\u305f\u306e\u306fdynamicMenu\u306e\u5b50\u3067\u3042\u3063\u3066<br \/>\nMenu\u306e\u5b50\u3058\u3083\u306a\u3044\u3067\u3059\u3088\u306d\u3002<br \/>\nsplitButton\u5185\u306emenu\u306e\u5b50\u3092\u5897\u3084\u3059\u65b9\u6cd5\u3092\u63a2\u3057\u3066\u3044\u305f\u306e\u3067<br \/>\n\u30bf\u30a4\u30c8\u30eb\u3068\u9055\u3046\u5185\u5bb9\u3060\u3063\u305f\u306e\u304c\u6b8b\u5ff5\u3067\u3059<\/p><\/blockquote>\n<p>\u305f\u3057\u304b\u306b\u53d6\u308a\u6271\u3063\u3066\u3044\u308b\u5185\u5bb9\u306f<span style=\"color: #ff0000; font-weight: bold;\">dynamicMenu\u8981\u7d20<\/span>\u306a\u3093\u3067\u3059\u304c\u3001<span style=\"color: #ff0000; font-weight: bold;\">getContent\u5c5e\u6027<\/span>\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067<span style=\"color: #ff0000; font-weight: bold;\">menu\u8981\u7d20<\/span>\u3092\u52d5\u7684\u306b\u8aad\u307f\u8fbc\u3093\u3067\u3001menu\u8981\u7d20\u306e\u5b50\u8981\u7d20\u3067\u3042\u308b<span style=\"color: #ff0000; font-weight: bold;\">button\u8981\u7d20<\/span>\u3092\u5897\u3084\u3057\u3066\u3044\u304f\u3001\u3068\u3044\u3063\u305f\u3053\u3068\u3092\u884c\u3063\u3066\u3044\u308b\u306e\u304c\u4e0a\u8a18\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n<p>\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u305f\u30ea\u30dc\u30f3\u3092\u52d5\u7684\u306b\u5909\u66f4\u3059\u308b\u5834\u5408\u306b\u3088\u304f\u4f7f\u3046\u306e\u304c<span style=\"color: #ff0000; font-weight: bold;\">getVisible\u5c5e\u6027<\/span>\u3084<span style=\"color: #ff0000; font-weight: bold;\">getEnabled\u5c5e\u6027<\/span>\u3001\u305d\u3057\u3066dynamicMenu\u8981\u7d20\u306e\u5c5e\u6027\u3067\u3042\u308b<span style=\"color: #ff0000; font-weight: bold;\">getContent\u5c5e\u6027<\/span>\u3067\u3059\u3002<\/p>\n<p>\u5358\u7d14\u306b\u8981\u7d20\u3092\u8868\u793a\u3057\u305f\u308a\u975e\u8868\u793a\u306b\u3057\u305f\u308a\u3001\u6709\u52b9\u30fb\u7121\u52b9\u3092\u5207\u308a\u66ff\u3048\u305f\u308a\u3059\u308b\u7a0b\u5ea6\u3067\u3042\u308c\u3070getVisible\u5c5e\u6027\u3084getEnabled\u5c5e\u6027\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3060\u3051\u3067\u5341\u5206\u306b\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u304c\u3001\u305d\u308c\u4ee5\u4e0a\u306b\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3092\u884c\u3044\u305f\u3044\u5834\u5408\u306f\u3001\u901a\u5e38getContent\u5c5e\u6027\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3067\u51e6\u7406\u3059\u308b\u3053\u3068\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u3044\u305f\u3060\u3044\u305f\u30b3\u30e1\u30f3\u30c8\u3001splitButton\u8981\u7d20\u306e\u5b50\u8981\u7d20\u306b\u3064\u3044\u3066\u3082\u3001menu\u8981\u7d20\u306e\u5b50\u8981\u7d20\u306e\u8868\u793a\u30fb\u975e\u8868\u793a\u3001\u6709\u52b9\u30fb\u7121\u52b9\u3092\u5207\u308a\u66ff\u3048\u308b\u7a0b\u5ea6\u3067\u5bfe\u5fdc\u3067\u304d\u306a\u3044\u306e\u3067\u3042\u308c\u3070\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306bmenu\u8981\u7d20\u306e\u5b50\u8981\u7d20\u3068\u3057\u3066dynamicMenu\u8981\u7d20\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u52d5\u7684\u306b\u5b50\u8981\u7d20\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>[\u30ea\u30dc\u30f3XML]<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;customUI onLoad=&quot;rbnSample_onLoad&quot; xmlns=&quot;http:\/\/schemas.microsoft.com\/office\/2006\/01\/customui&quot;&gt;\r\n  &lt;ribbon&gt;\r\n    &lt;tabs&gt;\r\n      &lt;tab id=&quot;tabSample&quot; label=&quot;Sample Tab&quot;&gt;\r\n        &lt;group id=&quot;grpSample&quot; label=&quot;Sample Group&quot;&gt;\r\n          &lt;splitButton id=&quot;slbSample&quot; size=&quot;large&quot;&gt;\r\n            &lt;button id=&quot;btnSample&quot; label=&quot;Button\u5897\u52a0&quot; imageMso=&quot;PlusSign&quot; onAction=&quot;btnSample_onAction&quot; \/&gt;\r\n            &lt;menu id=&quot;mnuSample&quot; itemSize=&quot;large&quot;&gt;\r\n              &lt;dynamicMenu id=&quot;dmuSample&quot; label=&quot;Sample Menu&quot; imageMso=&quot;HappyFace&quot; getContent=&quot;dmuSample_getContent&quot; \/&gt;\r\n            &lt;\/menu&gt;\r\n          &lt;\/splitButton&gt;\r\n        &lt;\/group&gt;\r\n      &lt;\/tab&gt;\r\n    &lt;\/tabs&gt;\r\n  &lt;\/ribbon&gt;\r\n&lt;\/customUI&gt;<\/pre>\n<p><strong>[\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb]<\/strong><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPrivate myRibbon As Office.IRibbonUI\r\nPrivate d As Object\r\n\r\nPrivate Sub rbnSample_onLoad(ribbon As IRibbonUI)\r\n  Dim elmButton As Object\r\n  Dim elmMenu As Object\r\n  \r\n  Set myRibbon = ribbon\r\n  \r\n  'XML\u521d\u671f\u8a2d\u5b9a\r\n  Set d = CreateObject(&quot;Msxml2.DOMDocument&quot;)\r\n  Set elmMenu = d.createElement(&quot;menu&quot;)\r\n  elmMenu.setAttribute &quot;xmlns&quot;, &quot;http:\/\/schemas.microsoft.com\/office\/2006\/01\/customui&quot;\r\n  elmMenu.setAttribute &quot;itemSize&quot;, &quot;large&quot;\r\n  Set elmButton = d.createElement(&quot;button&quot;)\r\n  elmButton.setAttribute &quot;id&quot;, &quot;btnChild1&quot;\r\n  elmButton.setAttribute &quot;label&quot;, &quot;Child Button1&quot;\r\n  elmButton.setAttribute &quot;imageMso&quot;, &quot;MicrosoftExcel&quot;\r\n  elmButton.setAttribute &quot;onAction&quot;, &quot;btnChild_onAction&quot;\r\n  elmMenu.appendChild elmButton\r\n  d.appendChild elmMenu\r\nEnd Sub\r\n\r\nPrivate Sub btnSample_onAction(control As IRibbonControl)\r\n'button\u8981\u7d20\u5897\u52a0\r\n  Dim num As Long\r\n  Dim n As Object\r\n  \r\n  num = d.getElementsByTagName(&quot;button&quot;).Length\r\n  Set n = d.createNode(1, &quot;button&quot;, d.DocumentElement.NamespaceURI)\r\n  With d.DocumentElement.appendChild(n)\r\n    .setAttribute &quot;id&quot;, &quot;btnChild&quot; &amp; num + 1\r\n    .setAttribute &quot;label&quot;, &quot;Child Button&quot; &amp; num + 1\r\n    .setAttribute &quot;imageMso&quot;, &quot;MicrosoftExcel&quot;\r\n    .setAttribute &quot;onAction&quot;, &quot;btnChild_onAction&quot;\r\n  End With\r\n  myRibbon.InvalidateControl &quot;dmuSample&quot;\r\nEnd Sub\r\n\r\nPrivate Sub btnChild_onAction(control As IRibbonControl)\r\n  MsgBox control.ID, vbInformation + vbSystemModal\r\nEnd Sub\r\n\r\nPrivate Sub dmuSample_getContent(control As IRibbonControl, ByRef returnedVal)\r\n  returnedVal = d.XML\r\nEnd Sub<\/pre>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/dynamicMenu_getContent_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/dynamicMenu_getContent_01.jpg\" alt=\"dynamicMenu_getContent_01\" width=\"614\" height=\"576\" class=\"alignnone size-full wp-image-5082\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/dynamicMenu_getContent_01.jpg 614w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/dynamicMenu_getContent_01-300x281.jpg 300w\" sizes=\"auto, (max-width: 614px) 100vw, 614px\" \/><\/a><\/p>\n<p>menu\u8981\u7d20\u306e\u4e2d\u306bdynamicMenu\u8981\u7d20\u3092\u5165\u308c\u308b\u306e\u3067\u3001\u30ef\u30f3\u30af\u30c3\u30b7\u30e7\u30f3\u7f6e\u304f\u5f62\u306b\u306f\u306a\u308a\u307e\u3059\u304c\u3001\u4e00\u5fdc\u76ee\u7684\u306f\u9054\u6210\u3067\u304d\u308b\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"3\u5e74\u307b\u3069\u524d\u306b\u66f8\u3044\u305f\u8a18\u4e8b\u300cmenu\u5185\u306b\u3042\u308bbutton\u306e\u6570\u3092\u5897\u3084\u3059\u300d\u306b\u30b3\u30e1\u30f3\u30c8\u3092\u3044\u305f\u3060\u304d\u307e\u3057\u305f\u3002 \u5897\u3084\u3057\u305f\u306e\u306fdynamicMenu\u306e\u5b50\u3067\u3042\u3063\u3066 Menu\u306e\u5b50\u3058\u3083\u306a\u3044\u3067\u3059\u3088\u306d\u3002 splitButton\u5185\u306emenu\u306e\u5b50\u3092\u5897\u3084 [&hellip;]","protected":false},"author":1,"featured_media":7130,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[],"class_list":["post-5081","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ribbon"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Ribbon.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1jX","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5081","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5081"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5081\/revisions"}],"predecessor-version":[{"id":5083,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5081\/revisions\/5083"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7130"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5081"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5081"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5081"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}