<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>uisplitpane &#8211; Undocumented Matlab</title>
	<atom:link href="https://undocumentedmatlab.com/articles/tag/uisplitpane/feed" rel="self" type="application/rss+xml" />
	<link>https://undocumentedmatlab.com</link>
	<description>Professional Matlab consulting, development and training</description>
	<lastBuildDate>Wed, 14 Jan 2015 21:41:18 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.7.2</generator>
	<item>
		<title>Unorthodox checkbox usage</title>
		<link>https://undocumentedmatlab.com/articles/unorthodox-checkbox-usage?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=unorthodox-checkbox-usage</link>
					<comments>https://undocumentedmatlab.com/articles/unorthodox-checkbox-usage#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 14 Jan 2015 21:41:18 +0000</pubDate>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[Medium risk of breaking in future versions]]></category>
		<category><![CDATA[UI controls]]></category>
		<category><![CDATA[Optical illusion]]></category>
		<category><![CDATA[uicontrol]]></category>
		<category><![CDATA[uisplitpane]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=5457</guid>

					<description><![CDATA[<p>There are various ways to display interactive split-panes in Matlab GUI. Uiextras flex-panels override a checkbox control's CData to display a divider. </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/unorthodox-checkbox-usage">Unorthodox checkbox usage</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/tri-state-checkbox" rel="bookmark" title="Tri-state checkbox">Tri-state checkbox </a> <small>Matlab checkboxes can easily be made to support tri-state functionality....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/profiling-matlab-memory-usage" rel="bookmark" title="Profiling Matlab memory usage">Profiling Matlab memory usage </a> <small>mtic and mtoc were a couple of undocumented features that enabled users of past Matlab releases to easily profile memory usage. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/transparency-in-uicontrols" rel="bookmark" title="Transparency in uicontrols">Transparency in uicontrols </a> <small>Matlab uicontrols' CData property can be customized to provide background transparency....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-listbox-editbox-scrollbars" rel="bookmark" title="Customizing listbox &amp; editbox scrollbars">Customizing listbox &amp; editbox scrollbars </a> <small>Matlab listbox and multi-line editbox uicontrols have pre-configured scrollbars. This article shows how they can be customized....</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>A few weeks ago, Robert Cumming <a target="_blank" href="/articles/transparency-in-uicontrols">explained</a> how we can use a Matlab uicontrol&#8217;s <b>CData</b> property to provide an optical illusion of a transparent background. Today I will discuss another usage of this property, providing a simple checkbox control the unorthodox appearance of a split-pane divider.<br />
The underlying problem description is easy: we wish to have the ability to split a Matlab uipanel into two or more sub-panels, separated by a draggable horizontal/vertical divider. Such split-panes are standard in any semi-decent GUI, but for some reason were never incorporated in official Matlab. This is a real pity, but not to worry as there are at least two alternatives we could use:</p>
<h3 id="UISplitPane">UISplitPane</h3>
<p><i><b>UISplitPane</b></i> is a <a target="_blank" rel="nofollow" href="http://www.mathworks.com/matlabcentral/fileexchange/23073-uisplitpane-split-a-container--figure-frame-uipanel--into-two-resizable-sub-containers">utility</a> that I wrote back in 2009 that uses a Java <code><a target="_blank" rel="nofollow" href="http://docs.oracle.com/javase/tutorial/uiswing/components/splitpane.html">JSplitPane</a></code> divider and associates it with plain Matlab panels on both sides. This solves the problem of embedding Matlab axes in Java panels, such as the ones provided by the standard Java <code>JSplitPane</code>. A detailed description of the technique can be found in my <a target="_blank" href="/articles/uisplitpane">dedicated post</a> on this utility.<br />
<figure id="attachment_120" aria-describedby="caption-attachment-120" style="width: 400px" class="wp-caption alignright"><img fetchpriority="high" decoding="async" src="https://undocumentedmatlab.com/blog/wp-content/uploads/2009/03/uisplitpane_animated.gif" alt="Two levels of UISplitPane, with customized dividers" title="Two levels of UISplitPane, with customized dividers" width="400" height="354" class="size-full wp-image-120" /><figcaption id="caption-attachment-120" class="wp-caption-text">Two levels of UISplitPane, with customized dividers</figcaption></figure></p>
<pre lang='matlab'>[hDown,hUp,hDiv1] = uisplitpane(gcf, 'Orientation','ver', 'dividercolor',[0,1,0]);
[hLeft,hRight,hDiv2] = uisplitpane(hDown, 'dividercolor','r', 'dividerwidth',3);
t=0:.1:10;
hax1=axes('Parent',hUp);    plot(t,sin(t));
hax2=axes('parent',hLeft);  plot(t,cos(t));
hax3=axes('parent',hRight); plot(t,tan(t));
hDiv1.DividerLocation = 0.75;    % one way to modify divider properties...
set(hDiv2,'DividerColor','red'); % ...and this is another way...
</pre>
<p><span id="more-5457"></span><br />
Making <i><b>UISplitPane</b></i> work in HG2 (R2014b onward) was quite a pain: numerous changes had to be made. For example, dynamic UDD properties can no longer be added to Matlab handles, only to Java ones. For Matlab handles, we now need to use the <i><b>addprop</b></i> function. For such properties, the UDD meta-property <code>SetFunction</code> is now called <code>SetMethod</code> (and similarly for Get) and only accepts function handles (not function handle cells as in UDD). Also, the UDD meta-property <code>AccessFlags.PublicSet='off'</code> needed to change to <code>SetAccess='private'</code>. Also, <b><i>handle.listener</b></i> no longer works; instead, we need to use the <i><b>addlistener</b></i> function. There are quite a few other similar tweaks, but <i><b>UISplitPane</b></i>now hopefully works well on both old (HG1, R2014a and earlier) and new (HG2, R2014b+) Matlab releases. Let me know if you still see unhandled issues.</p>
<h3 id="uiextras">UIExtras flex-box</h3>
<p>UIExtras (officially named &#8220;GUI Layout Toolbox&#8221;) is a toolbox of very useful GUI handling functions related to layout management. Written within MathWorks and originally posted in 2010, it has been under continuous maintenance ever since. While being called a &#8220;toolbox&#8221;, it is in fact freely-downloadable from the Matlab File Exchange.<br />
The new HG2 introduced in R2014b did not just make code porting difficult for me &#8211; uiextras&#8217; developers (MathWorkers Ben Tordoff and David Sampson) also encountered great difficulties in porting the code and making sure that it is backward compatible with HG1. In the end they gave up and we now have two distinct versions of the toolbox: the <a target="_blank" rel="nofollow" href="http://www.mathworks.com/matlabcentral/fileexchange/27758-gui-layout-toolbox">original version for HG1</a> (R2014a and earlier) and a <a target="_blank" rel="nofollow" href="http://www.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox">new version for HG2</a> (R2014b+).<br />
In my opinion, uiextras is one of the greatest examples of Matlab code on the File Exchange. It is well-written, well-documented and highly performant (although I would also have preferred it to be a bit more robust, it sometimes complains when used). Readers could benefit greatly by studying its techniques, and today&#8217;s subject topic is one such example. Specifically, the split-pane divider in uiextras (used by HBoxFlex and VBoxFlex) is simply a Matlab uicontrol having a custom <b>CData</b> property. This <b>CData</b> value is computed and set programmatically (at the bottom of <i><b><a target="_blank" rel="nofollow" href="http://www.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox/content//layout/+uix/Divider.m">uix.Divider</a></b></i>) to display a flat color with some markings at the center (&#8220;hand-holds&#8221;, a visual cue for interactive dragging, which can be turned off if requested). Thus, for a vertical divider (for an HBoxFlex container) of height 100 pixels and width of 5 pixels, we would get a <b>CData</b> of 100x5x3 (x3 for RGB colors):</p>
<pre lang='matlab'>
hHBox = uiextras.HBoxFlex('Spacing',6, 'BackgroundColor','b');  % Spacing=6 means divider width =6px, and CData width =5px
hLeft  = uicontrol('parent',hHBox, 'style','check', 'string','Left split pane');
hRight = uicontrol('parent',hHBox, 'style','radio', 'string','Right split pane');
</pre>
<p><center><figure style="width: 335px" class="wp-caption aligncenter"><img decoding="async" alt="UIExtras HBoxFlex with draggable split-pane divider" src="https://undocumentedmatlab.com/images/UIExtras_HBoxFlex.png" title="UIExtras HBoxFlex with draggable split-pane divider" width="335" height="190" /><figcaption class="wp-caption-text">UIExtras HBoxFlex with draggable split-pane divider</figcaption></figure></center><br />
The divider handle is a private property, so we cannot readily access it. However, as I have <a target="_blank" href="/articles/accessing-private-object-properties">explained</a> last year, we can use the builtin <i><b>struct</b></i> function:</p>
<pre lang='matlab'>
oldWarn = warning('off','MATLAB:structOnObject');  % temporarily disable warning message on discouraged usage
hHBox_data = struct(hHBox);  % this includes hidden/private properties
warning(oldWarn);
hDividers = hHBox_data.Dividers;  % multiple dividers are possible in HBoxFlex/VBoxFlex
cdata = get(hDividers(1), 'CData');
</pre>
<p>A very nice trick here is that this divider uicontrol is <i>not</i> a pushbutton as we might have expected. Instead, it is a checkbox control. And while it does not look anything like a standard checkbox (due to the custom <b>CData</b>), checkboxes (and radio-buttons) have a very important advantage that caused them to be preferable over buttons: in buttons, there is always a small border showing at the control&#8217;s edges, but checkboxes do not have any 3D appearance, or in other words they do not have a border &#8212; their <b>CData</b> can span the entire extent of the control. Neat, right?<br />
This enables us to customize the appearance of checkboxes (and radios) to any arbitrary shape, by setting the relevant <b>CData</b> pixels to transparent/bgcolor (as Robert showed last week for buttons). Matlab GUI controls no longer need to look a boring rectangle. We can have clickable stars, draggable icons, and other similar uses. This really opens up the possibilities for rich GUI appearance. If anyone uses this feature, please do post a comment below (preferably with a nice screenshot!).</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/unorthodox-checkbox-usage">Unorthodox checkbox usage</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/tri-state-checkbox" rel="bookmark" title="Tri-state checkbox">Tri-state checkbox </a> <small>Matlab checkboxes can easily be made to support tri-state functionality....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/profiling-matlab-memory-usage" rel="bookmark" title="Profiling Matlab memory usage">Profiling Matlab memory usage </a> <small>mtic and mtoc were a couple of undocumented features that enabled users of past Matlab releases to easily profile memory usage. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/transparency-in-uicontrols" rel="bookmark" title="Transparency in uicontrols">Transparency in uicontrols </a> <small>Matlab uicontrols' CData property can be customized to provide background transparency....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/customizing-listbox-editbox-scrollbars" rel="bookmark" title="Customizing listbox &amp; editbox scrollbars">Customizing listbox &amp; editbox scrollbars </a> <small>Matlab listbox and multi-line editbox uicontrols have pre-configured scrollbars. This article shows how they can be customized....</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/unorthodox-checkbox-usage/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Real-time trading system demo</title>
		<link>https://undocumentedmatlab.com/articles/real-time-trading-system-demo?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=real-time-trading-system-demo</link>
					<comments>https://undocumentedmatlab.com/articles/real-time-trading-system-demo#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Wed, 29 May 2013 13:15:21 +0000</pubDate>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[Medium risk of breaking in future versions]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[uisplitpane]]></category>
		<category><![CDATA[uitable]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=3825</guid>

					<description><![CDATA[<p>A real-time Matlab-based end-to-end trading system demo is presented </p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/real-time-trading-system-demo">Real-time trading system demo</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/jtattoo-look-and-feel-demo" rel="bookmark" title="JTattoo look-and-feel demo">JTattoo look-and-feel demo </a> <small>A demo GUI that shows the effects of using different look-and-feels, including the JTatoo library, is presented. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/simple-gui-tabs-for-advanced-matlab-trading-app" rel="bookmark" title="Simple GUI Tabs for Advanced Matlab Trading App">Simple GUI Tabs for Advanced Matlab Trading App </a> <small>A new File Exchange utility enables to easily design GUI tabs using Matlab's GUIDE...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/nyc-visit-may-2013" rel="bookmark" title="New York City visit, 21-24 May 2013">New York City visit, 21-24 May 2013 </a> <small>I will be visiting New York 21-24 May 2013 to speak at the Matlab Computational Finance Conference. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/rich-contents-log-panel" rel="bookmark" title="Rich-contents log panel">Rich-contents log panel </a> <small>Matlab listboxes and editboxes can be used to display rich-contents HTML-formatted strings, which is ideal for log panels. ...</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>Last week I gave a presentation at the <a target="_blank" rel="nofollow" href="http://www.mathworks.com/company/events/conferences/matlab-computational-finance-conference-nyc/2013/agenda.html">MATLAB Computational Finance Conference</a> in New York. The room was packed-full with close to 200 professionals in the finance industry. The energy and feedback were tremendous, it was a great experience. The presentation (PDF format) is provided <a target="_blank" href="/files/Matlab%20real-time%20trading%20presentation.pdf">here</a>.<br />
I presented a demo application that showed how Matlab can be used to create a full end-to-end trading system, highlighting Matlab&#8217;s potential as a platform of choice. I used <a target="_blank" rel="nofollow" href="http://www.interactivebrokers.com/en/main.php">Interactive Brokers</a> to demonstrate live market data feed and account/portfolio input, as well as for sending trading orders to the market, via the <a target="_blank" href="/ib-matlab/">IB-Matlab</a> connector:<br />
<center><figure style="width: 450px" class="wp-caption aligncenter"><a target="_blank" href="/images/demo_screenshot.png"><img decoding="async" alt="Real-time trading system demo in Matlab (click for details)" src="https://undocumentedmatlab.com/images/demo_screenshot.png" title="Real-time trading system demo in Matlab (click for details)" width="560" height="289" /></a><figcaption class="wp-caption-text">Real-time trading system demo in Matlab (click for details)</figcaption></figure></center><br />
The demo system&#8217;s user interface showcased the hidden visualization and interactivity potential of MATLAB for tracking order executions and charting financial time-series in real time. The undocumented features used in the demo include:</p>
<ul>
<li><a target="_blank" href="/articles/displaying-animated-gifs/">Animated GIF logo image</a> (rotating Dollar sign)</li>
<li><a target="_blank" href="/articles/uitable-customization-report/">Customized data table</a></li>
<li><a target="_blank" href="/articles/rich-matlab-editbox-contents/">Log box with rich HTML contents</a>: icons and color-coded messages</li>
<li><a target="_blank" href="/articles/uisplitpane/">Draggable (resizable) panel borders</a> (note that this feature does not work in the new <a target="_blank" href="/articles/hg2-update/">HG2</a> &#8211; I hope it will be fixed by the time that HG2 is released)</li>
<li><a target="_blank" href="/articles/minimize-maximize-figure-window/">Maximized figure window</a></li>
</ul>
<p>The demo source code is provided <a target="_blank" href="/files/Matlab%20trading%20demo.zip">here</a> (tradingDemo.m and supporting files). Note that this is provided as-is, free of charge but without any warranty or support. You would naturally need <a target="_blank" href="/ib-matlab/">IB-Matlab</a> and an Interactive Brokers account to run it.<br />
If you came to the conference, I want to thank you for being an excellent audience. I hope we have a chance to work together on your projects. Shoot me <a href="mailto: altmany @gmail.com?subject=Matlab assistance&amp;body=Hi Yair, &amp;cc=;&amp;bcc=" rel="nofollow" target="_blank" onclick="var n='altmany'; var d='gmail.com'; window.open('mailto:'+n+'@'+d+'?subject=Matlab assistance&amp;body=Hi Yair, '); return false;">an email</a> if you&#8217;d like my help in any consulting, training or development work.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/real-time-trading-system-demo">Real-time trading system demo</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/jtattoo-look-and-feel-demo" rel="bookmark" title="JTattoo look-and-feel demo">JTattoo look-and-feel demo </a> <small>A demo GUI that shows the effects of using different look-and-feels, including the JTatoo library, is presented. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/simple-gui-tabs-for-advanced-matlab-trading-app" rel="bookmark" title="Simple GUI Tabs for Advanced Matlab Trading App">Simple GUI Tabs for Advanced Matlab Trading App </a> <small>A new File Exchange utility enables to easily design GUI tabs using Matlab's GUIDE...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/nyc-visit-may-2013" rel="bookmark" title="New York City visit, 21-24 May 2013">New York City visit, 21-24 May 2013 </a> <small>I will be visiting New York 21-24 May 2013 to speak at the Matlab Computational Finance Conference. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/rich-contents-log-panel" rel="bookmark" title="Rich-contents log panel">Rich-contents log panel </a> <small>Matlab listboxes and editboxes can be used to display rich-contents HTML-formatted strings, which is ideal for log panels. ...</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/real-time-trading-system-demo/feed</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>UISplitPane</title>
		<link>https://undocumentedmatlab.com/articles/uisplitpane?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=uisplitpane</link>
					<comments>https://undocumentedmatlab.com/articles/uisplitpane#comments</comments>
		
		<dc:creator><![CDATA[Yair Altman]]></dc:creator>
		<pubDate>Sat, 28 Mar 2009 22:49:07 +0000</pubDate>
				<category><![CDATA[GUI]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Listeners]]></category>
		<category><![CDATA[Medium risk of breaking in future versions]]></category>
		<category><![CDATA[UI controls]]></category>
		<category><![CDATA[uicontrol]]></category>
		<category><![CDATA[uisplitpane]]></category>
		<guid isPermaLink="false">http://undocumentedmatlab.com/?p=119</guid>

					<description><![CDATA[<p>UISplitPane was recently chosen as Matlab Central's Pick of the Week. Here I detail its use of some undocumented Matlab features.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/uisplitpane">UISplitPane</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/unorthodox-checkbox-usage" rel="bookmark" title="Unorthodox checkbox usage">Unorthodox checkbox usage </a> <small>There are various ways to display interactive split-panes in Matlab GUI. Uiextras flex-panels override a checkbox control's CData to display a divider. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/fixing-a-java-focus-problem" rel="bookmark" title="Fixing a Java focus problem">Fixing a Java focus problem </a> <small>Java components added to Matlab GUIs do not participate in the standard focus cycle - this article explains how to fix this problem....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/common-javacomponent-problems" rel="bookmark" title="Common javacomponent problems">Common javacomponent problems </a> <small>The javacomponent function is very useful for placing Java components on-screen, but has a few quirks. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/continuous-slider-callback" rel="bookmark" title="Continuous slider callback">Continuous slider callback </a> <small>Matlab slider uicontrols do not enable a continuous-motion callback by default. This article explains how this can be achieved using undocumented features....</small></li>
</ol>
</div>
]]></description>
										<content:encoded><![CDATA[<p>One of my many File Exchange submissions, <a href="http://www.mathworks.com/matlabcentral/fileexchange/23073" target="_blank" rel="nofollow">UISplitPane</a>, was chosen yesterday as <a href="http://blogs.mathworks.com/pick/2009/03/27/gui-layout-part-6/" target="_blank" rel="nofollow">Matlab Central&#8217;s Pick of the Week</a> (thanks Jiro!). UISplitPane was probably my most challenging submission to date. I thought it would be a good point in time to share some of the undocumented features that I used in UISplitPane. Readers are encouraged to download UISplitPane.m and look at its code.<br />
The basic problem which UISplitPane solves is the inability in Matlab to construct a dual pane separated by an interactive divider. Such split-panes are very common in modern GUIs, including Matlab tools, but were never available for Matlab GUIs. Java Swing has the JSplitPane control, but Matlab axes cannot (as yet) be added to Java containers. A similar problem exists for <a target="_blank" href="/articles/tab-panels-uitab-and-relatives/">tabbed-panes</a>, and Matlab provided a very innovative solution for this (the semi-documented <strong><em>uitabgroup</em></strong> function), which is described in a <a target="_blank" href="/articles/tab-panels-uitab-and-relatives/">separate post</a>. Unfortunately, <strong><em>uitabgroup</em></strong>&#8216;s solution cannot be applied to the split-pane problem since in JSplitPane&#8217;s case, the container overlaps the axes-containing panes.<br />
To make a long story short, the solution was to create an off-screen (invisible) JSplitPane, extract only its narrow central divider sub-component, and place that onscreen using <em><strong>javacomponent</strong></em>. I encourage readers to look at the <em>addDivider()</em> function which does this, setting mouse cursor and other interesting properties.<br />
The Java divider&#8217;s reference is then converted into a Matlab <em><strong>handle</strong></em>, so that some extra properties can be added using <em><strong>schema.prop</strong></em> (which [you guessed it] will be described in a later post) and will become visible when using regular <em><strong>get</strong></em>.<br />
Pure-Matlab code then attaches standard Matlab uipanels as sub-panes on either side of the divider. Property linkages (this will be detailed in later posts about schema.prop&#8217;s getter/setter functions and <em><strong>handle.listener</strong></em>) ensure that whenever the divider is dragged or programmatically modified, the two sub-panes on its sides will be resized accordingly, together with all their content (axes and controls). Since the two split panes are simple uipanels, they can contain not only axes and controls but also other uisplitpanes, creating a hierarchy of split-panes:</p>
<pre lang='matlab'>
[hDown,hUp,hDiv1] = uisplitpane(gcf, 'Orientation','ver', 'dividercolor',[0,1,0]);
[hLeft,hRight,hDiv2] = uisplitpane(hDown, 'dividercolor','r', 'dividerwidth',3);
t=0:.1:10;
hax1=axes('Parent',hUp);    plot(t,sin(t));
hax2=axes('parent',hLeft);  plot(t,cos(t));
hax3=axes('parent',hRight); plot(t,tan(t));
hDiv1.DividerLocation = 0.75;    % one way to modify divider properties...
set(hDiv2,'DividerColor','red'); % ...and this is another way...
</pre>
<p><center><figure id="attachment_120" aria-describedby="caption-attachment-120" style="width: 400px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" src="https://undocumentedmatlab.com/blog/wp-content/uploads/2009/03/uisplitpane_animated.gif" alt="Two levels of UISplitPane, with customized dividers" title="Two levels of UISplitPane, with customized dividers" width="400" height="354" class="size-full wp-image-120" /><figcaption id="caption-attachment-120" class="wp-caption-text">Two levels of UISplitPane, with customized dividers</figcaption></figure></center><br />
UISplitPane makes use of some semi-documented internal helper functions: <em><strong>hgfeval</strong></em> is used in the mouse callbacks, in order to chain the original WindowButton callback (if available); <em><strong>setptr</strong></em> is used to set the mouse pointer (cursor).<br />
UISplitPane behaves nicely in the presence of Mode Managers (zoom, pan, &#8230;) by using the figure&#8217;s undocumented &#8216;ModeManager&#8217; property and setting its &#8216;ButtonDownFilter&#8217; to bypass mode.<br />
Finally, the figure&#8217;s undocumented &#8216;JavaFrame&#8217; property is used to get a reference to the figure&#8217;s AxisComponent container, which is needed for setting mouse callbacks that behave better than similar callbacks at the figure level.<br />
All-in-all, UISplitPane is perhaps a good example of combining a variety of unrelated undocumented Matlab features in order to achieve a coherent application.<br />
An interesting side-note: Matlab 7.6 (R2008a) and onward contain a reference to <em><strong>uisplittool</strong></em> and <em><strong>uitogglesplittool</strong></em> in the javacomponent.m and %matlabroot%/bin/registry/hg.xml files. These are not valid functions (built-in or otherwise) and I could not figure out how this functionality can actually be used. At the very least it is certain that it is deeply undocumented and (of course) unsupported, leaving an open mystery for future investigation&#8230;<br />
<u><b>Addendum Jan 14, 2015</b></u>: For an alternative implementation of split-panes, see <a target="_blank" href="/articles/unorthodox-checkbox-usage">here</a>.</p>
<p>The post <a rel="nofollow" href="https://undocumentedmatlab.com/articles/uisplitpane">UISplitPane</a> appeared first on <a rel="nofollow" href="https://undocumentedmatlab.com">Undocumented Matlab</a>.</p>
<div class='yarpp-related-rss'>
<h3>Related posts:</h3><ol>
<li><a href="https://undocumentedmatlab.com/articles/unorthodox-checkbox-usage" rel="bookmark" title="Unorthodox checkbox usage">Unorthodox checkbox usage </a> <small>There are various ways to display interactive split-panes in Matlab GUI. Uiextras flex-panels override a checkbox control's CData to display a divider. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/fixing-a-java-focus-problem" rel="bookmark" title="Fixing a Java focus problem">Fixing a Java focus problem </a> <small>Java components added to Matlab GUIs do not participate in the standard focus cycle - this article explains how to fix this problem....</small></li>
<li><a href="https://undocumentedmatlab.com/articles/common-javacomponent-problems" rel="bookmark" title="Common javacomponent problems">Common javacomponent problems </a> <small>The javacomponent function is very useful for placing Java components on-screen, but has a few quirks. ...</small></li>
<li><a href="https://undocumentedmatlab.com/articles/continuous-slider-callback" rel="bookmark" title="Continuous slider callback">Continuous slider callback </a> <small>Matlab slider uicontrols do not enable a continuous-motion callback by default. This article explains how this can be achieved using undocumented features....</small></li>
</ol>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://undocumentedmatlab.com/articles/uisplitpane/feed</wfw:commentRss>
			<slash:comments>18</slash:comments>
		
		
			</item>
	</channel>
</rss>
