<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Customizing figure toolbar background	</title>
	<atom:link href="https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=customizing-figure-toolbar-background</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Mon, 17 Oct 2016 22:33:50 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-390921</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Mon, 17 Oct 2016 22:33:50 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3634#comment-390921</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-390912&quot;&gt;masi&lt;/a&gt;.

I used a standard radar-plot layout: North is up (0/360 degs); South is down (180 degs); degrees increasing clockwise from top (North pole).]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-390912">masi</a>.</p>
<p>I used a standard radar-plot layout: North is up (0/360 degs); South is down (180 degs); degrees increasing clockwise from top (North pole).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: masi		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-390912</link>

		<dc:creator><![CDATA[masi]]></dc:creator>
		<pubDate>Mon, 17 Oct 2016 17:54:38 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3634#comment-390912</guid>

					<description><![CDATA[Which polar coordinate system did you use for your solution in MATLAB 2013? 

I am trying to integrate your code to MATLAB 2016b `polaraxes` + `warp` in the thread here http://stackoverflow.com/q/40086038/54964]]></description>
			<content:encoded><![CDATA[<p>Which polar coordinate system did you use for your solution in MATLAB 2013? </p>
<p>I am trying to integrate your code to MATLAB 2016b `polaraxes` + `warp` in the thread here <a href="http://stackoverflow.com/q/40086038/54964" rel="nofollow ugc">http://stackoverflow.com/q/40086038/54964</a></p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Zheng Liu		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-174117</link>

		<dc:creator><![CDATA[Zheng Liu]]></dc:creator>
		<pubDate>Sat, 16 Mar 2013 01:57:23 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3634#comment-174117</guid>

					<description><![CDATA[Dear Yair:
 
I put the two techniques (http://undocumentedmatlab.com/blog/figure-toolbar-customizations/ and http://undocumentedmatlab.com/blog/customizing-figure-toolbar-background/) designed by you together, I hope to change the background while floating the toolbar, this effect has been achieved in function, but there are a few small issues to be resolved, the questions are as follows:
(1) How should I do to specify the location of the toolbar while floating? unfortunately, my way (&lt;code&gt;jTbar.getUI.setFloating(true,java.awt.Point(0,0));&lt;/code&gt;) does not work;
(2) How should I do to control the emergence and disappear of the toolbar via right-click menu(for example attached to the current GUI figure)? I currently take a drag-and-off style.

Yours Sincerely.


My code (in the &quot;*_OutputFcn()&quot; that is generated by GUIDE) is as follows:
&lt;pre lang=&#039;matlab&#039;&gt;
% --- Outputs from this function are returned to the command line.
function varargout = toolbar_demo_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;
jTbar = get(get(findall(handles.figure_main,&#039;tag&#039;,&#039;uitoolbar1&#039;),&#039;JavaContainer&#039;),&#039;ComponentPeer&#039;);
color = java.awt.Color.red;
jTbar.setBackground(color);
jTbar.getParent.getParent.setBackground(color);
jtbc = jTbar.getComponents;
for idx=1:length(jtbc)
    jtbc(idx).setOpaque(false);
    jtbc(idx).setBackground(color);
    for childIdx = 1 : length(jtbc(idx).getComponents)
        jtbc(idx).getComponent(childIdx-1).setBackground(color);
    end
end
jTbar.setBorderPainted(false);
jFrame = get(handle(handles.figure_main),&#039;JavaFrame&#039;);
jFrame.showTopSeparator(false);
jTbCon = jTbar.getParent;
jLayout = java.awt.FlowLayout(0,0,0);
jTbar.setLayout(jLayout);
jTbar.setFloatable(true);
jTbar.getUI.setFloating(true,java.awt.Point(0,0));
jCpts = jTbar.getComponents;
for i = 1 : length(jCpts)
    jMls = jCpts(i).getMouseListeners;
    for j = 1 : length(jMls)
        if ~isempty(strfind(get(jMls(j),&#039;type&#039;),&#039;FlyOverListener&#039;))
            jCpts(i).removeMouseListener(jMls(j))
            jCls = jCpts(i).getChangeListeners;
            if ~isempty(strfind(get(jCls(1),&#039;type&#039;),&#039;FlyOverListener&#039;))
                jCpts(i).removeChangeListener(jCls(1))
            end
        end
    end
end
hjTbar = handle(jTbar,&#039;CallbackProperties&#039;);
dockUndockCallbackFcn(hjTbar,1,jTbCon)
set(hjTbar,&#039;AncestorAddedCallback&#039;,{@dockUndockCallbackFcn,jTbCon});

function dockUndockCallbackFcn(src, ~, jTbc)
if src.isFloating
    jWin = src.getTopLevelAncestor;
    jWin.setResizable(true)
    jWin.setPreferredSize(java.awt.Dimension(450,57));
    jWin.setSize(java.awt.Dimension(450,57));
    jTbc.setVisible(false)
    set(jWin,&#039;WindowClosingCallback&#039;,@(~,~)jTbc.setVisible(true))
end
&lt;/pre&gt;
]]></description>
			<content:encoded><![CDATA[<p>Dear Yair:</p>
<p>I put the two techniques (<a href="http://undocumentedmatlab.com/blog/figure-toolbar-customizations/" rel="ugc">http://undocumentedmatlab.com/blog/figure-toolbar-customizations/</a> and <a href="http://undocumentedmatlab.com/blog/customizing-figure-toolbar-background/" rel="ugc">http://undocumentedmatlab.com/blog/customizing-figure-toolbar-background/</a>) designed by you together, I hope to change the background while floating the toolbar, this effect has been achieved in function, but there are a few small issues to be resolved, the questions are as follows:<br />
(1) How should I do to specify the location of the toolbar while floating? unfortunately, my way (<code>jTbar.getUI.setFloating(true,java.awt.Point(0,0));</code>) does not work;<br />
(2) How should I do to control the emergence and disappear of the toolbar via right-click menu(for example attached to the current GUI figure)? I currently take a drag-and-off style.</p>
<p>Yours Sincerely.</p>
<p>My code (in the &#8220;*_OutputFcn()&#8221; that is generated by GUIDE) is as follows:</p>
<pre lang='matlab'>
% --- Outputs from this function are returned to the command line.
function varargout = toolbar_demo_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;
jTbar = get(get(findall(handles.figure_main,'tag','uitoolbar1'),'JavaContainer'),'ComponentPeer');
color = java.awt.Color.red;
jTbar.setBackground(color);
jTbar.getParent.getParent.setBackground(color);
jtbc = jTbar.getComponents;
for idx=1:length(jtbc)
    jtbc(idx).setOpaque(false);
    jtbc(idx).setBackground(color);
    for childIdx = 1 : length(jtbc(idx).getComponents)
        jtbc(idx).getComponent(childIdx-1).setBackground(color);
    end
end
jTbar.setBorderPainted(false);
jFrame = get(handle(handles.figure_main),'JavaFrame');
jFrame.showTopSeparator(false);
jTbCon = jTbar.getParent;
jLayout = java.awt.FlowLayout(0,0,0);
jTbar.setLayout(jLayout);
jTbar.setFloatable(true);
jTbar.getUI.setFloating(true,java.awt.Point(0,0));
jCpts = jTbar.getComponents;
for i = 1 : length(jCpts)
    jMls = jCpts(i).getMouseListeners;
    for j = 1 : length(jMls)
        if ~isempty(strfind(get(jMls(j),'type'),'FlyOverListener'))
            jCpts(i).removeMouseListener(jMls(j))
            jCls = jCpts(i).getChangeListeners;
            if ~isempty(strfind(get(jCls(1),'type'),'FlyOverListener'))
                jCpts(i).removeChangeListener(jCls(1))
            end
        end
    end
end
hjTbar = handle(jTbar,'CallbackProperties');
dockUndockCallbackFcn(hjTbar,1,jTbCon)
set(hjTbar,'AncestorAddedCallback',{@dockUndockCallbackFcn,jTbCon});

function dockUndockCallbackFcn(src, ~, jTbc)
if src.isFloating
    jWin = src.getTopLevelAncestor;
    jWin.setResizable(true)
    jWin.setPreferredSize(java.awt.Dimension(450,57));
    jWin.setSize(java.awt.Dimension(450,57));
    jTbc.setVisible(false)
    set(jWin,'WindowClosingCallback',@(~,~)jTbc.setVisible(true))
end
</pre>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Zheng Liu		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-173829</link>

		<dc:creator><![CDATA[Zheng Liu]]></dc:creator>
		<pubDate>Fri, 15 Mar 2013 15:13:32 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3634#comment-173829</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-172157&quot;&gt;Yair Altman&lt;/a&gt;.

Dear Yair, thank you very much for your timely reply, your suggestion gave me a very critical help, wish you good luck.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-172157">Yair Altman</a>.</p>
<p>Dear Yair, thank you very much for your timely reply, your suggestion gave me a very critical help, wish you good luck.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Yair Altman		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-172157</link>

		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 21:34:19 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3634#comment-172157</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-171960&quot;&gt;Zheng Liu&lt;/a&gt;.

@Zheng - follow the steps outlined in the article, simply modify
&lt;pre lang=&#039;matlab&#039;&gt;hToolbar = findall(hFig,&#039;tag&#039;,&#039;FigureToolBar&#039;);&lt;/pre&gt;
to:
&lt;pre lang=&#039;matlab&#039;&gt;hToolbar = findall(handles.hObject,&#039;tag&#039;,&#039;uitoolbar1&#039;);&lt;/pre&gt;
in your *_OutputFcn() function that is generated by GUIDE. 

The rest of the code in my article should follow this line (use &lt;code&gt;handles.hObject&lt;/code&gt; wherever it says &lt;code&gt;hFig&lt;/code&gt; in my article).]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-171960">Zheng Liu</a>.</p>
<p>@Zheng &#8211; follow the steps outlined in the article, simply modify</p>
<pre lang='matlab'>hToolbar = findall(hFig,'tag','FigureToolBar');</pre>
<p>to:</p>
<pre lang='matlab'>hToolbar = findall(handles.hObject,'tag','uitoolbar1');</pre>
<p>in your *_OutputFcn() function that is generated by GUIDE. </p>
<p>The rest of the code in my article should follow this line (use <code>handles.hObject</code> wherever it says <code>hFig</code> in my article).</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Zheng Liu		</title>
		<link>https://undocumentedmatlab.com/articles/customizing-figure-toolbar-background#comment-171960</link>

		<dc:creator><![CDATA[Zheng Liu]]></dc:creator>
		<pubDate>Tue, 12 Mar 2013 13:41:30 +0000</pubDate>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3634#comment-171960</guid>

					<description><![CDATA[Hi Yair:

Thank you for your contribution, it is an excellent work, if my figure is a GUI (created by GUIDE), how should I change my customized Toolbar&#039;s backgroundcolor? suppose my Toolbar&#039;s Tag is uitoolbar1, thank you very much.]]></description>
			<content:encoded><![CDATA[<p>Hi Yair:</p>
<p>Thank you for your contribution, it is an excellent work, if my figure is a GUI (created by GUIDE), how should I change my customized Toolbar&#8217;s backgroundcolor? suppose my Toolbar&#8217;s Tag is uitoolbar1, thank you very much.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
