<?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 listbox &amp; editbox scrollbars</title> <atom:link href="http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/feed/" rel="self" type="application/rss+xml" /><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/</link> <description>Charting Matlab's unsupported hidden underbelly</description> <lastBuildDate>Fri, 18 May 2012 13:56:51 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.1.1</generator> <item><title>By: Adeel</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-85813</link> <dc:creator>Adeel</dc:creator> <pubDate>Sun, 13 May 2012 06:18:42 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-85813</guid> <description>I want maintain the scroll bar with respect to my matching text .For example in my page if there is Adeel in first existance than the scroll bar set on this Index. Please help me out</description> <content:encoded><![CDATA[<p>I want maintain the scroll bar with respect to my matching text .For example in my page if there is Adeel in first existance than the scroll bar set on this Index. Please help me out</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-78881</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Sat, 24 Mar 2012 16:43:14 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-78881</guid> <description>@Gonzalo - you can do this in the callback function for the slider. If you need help in this development (for a fee), then contact me offline using the email link at the top-left of this page.</description> <content:encoded><![CDATA[<p>@Gonzalo &#8211; you can do this in the callback function for the slider. If you need help in this development (for a fee), then contact me offline using the email link at the top-left of this page.</p> ]]></content:encoded> </item> <item><title>By: Gonzalo</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-78861</link> <dc:creator>Gonzalo</dc:creator> <pubDate>Sat, 24 Mar 2012 11:12:48 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-78861</guid> <description>Hello Yair,I show three edit text boxes. I want that when you move the first one`s slider( so you get the text from the line 12, for example) the other two show the text from the same line as the first one.Do you know any way to do so?Thanks,
Gonzalo</description> <content:encoded><![CDATA[<p>Hello Yair,</p><p>I show three edit text boxes. I want that when you move the first one`s slider( so you get the text from the line 12, for example) the other two show the text from the same line as the first one.</p><p>Do you know any way to do so?</p><p>Thanks,<br
/> Gonzalo</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-11239</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Fri, 18 Jun 2010 15:08:52 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-11239</guid> <description>@Carrie, @Camilo and others: If you get an error when you try to use the enumerated (non-numeric) policy values, then you can simply cast the Matlab handle() of the Java reference back into a Java reference. For example:&lt;pre lang=&quot;matlab&quot;&gt;jScrollPane.java.HORIZONTAL_SCROLLBAR_AS_NEEDED&lt;/pre&gt;Alternately, as mentioned above, you can always use the numeric values of these enumerated policies. They are less readable/maintainable, but they always work :-)</description> <content:encoded><![CDATA[<p>@Carrie, @Camilo and others: If you get an error when you try to use the enumerated (non-numeric) policy values, then you can simply cast the Matlab handle() of the Java reference back into a Java reference. For example:</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;">jScrollPane.<span style="">java</span>.<span style="">HORIZONTAL_SCROLLBAR_AS_NEEDED</span></pre></div></div><p>Alternately, as mentioned above, you can always use the numeric values of these enumerated policies. They are less readable/maintainable, but they always work <img
src='http://undocumentedmatlab.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-9909</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Wed, 12 May 2010 14:51:09 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-9909</guid> <description>@Jeroen - It doesn&#039;t work in your creation callbacks because the figure is not yet visible at that point and &lt;i&gt;&lt;b&gt;findjobj&lt;/b&gt;&lt;/i&gt; requires a visible figure to find the underlying Java handles. This is why you see an empty handle list. This is also the reason it doesn&#039;t work in your _OpeningFcn() function. Instead, place your code in the _OutputFcn() function, which is called immediately after the figure becomes visible.</description> <content:encoded><![CDATA[<p>@Jeroen &#8211; It doesn&#8217;t work in your creation callbacks because the figure is not yet visible at that point and <i><b>findjobj</b></i> requires a visible figure to find the underlying Java handles. This is why you see an empty handle list. This is also the reason it doesn&#8217;t work in your _OpeningFcn() function. Instead, place your code in the _OutputFcn() function, which is called immediately after the figure becomes visible.</p> ]]></content:encoded> </item> <item><title>By: Jeroen Boschma</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-9906</link> <dc:creator>Jeroen Boschma</dc:creator> <pubDate>Wed, 12 May 2010 13:27:03 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-9906</guid> <description>Hi Yair,It works only half for me, hopefully you can point me in the correct direction. Currently working with :-----------------------------------------------------------------------------------
MATLAB Version 7.4.0.287 (R2007a)
Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 3)
Java VM Version: Java 1.5.0_07 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
-----------------------------------------------------------------------------------For testing I put a button and edit on a figure in GUIDE, I have a function to change the properties of the edit:&lt;pre lang=&quot;matlab&quot;&gt;
function r = set_edit_props(varargin)r = true;
try
h           = findobj(&#039;Tag&#039;, &#039;edit2&#039;);
jScrollPane = findjobj(h);
jViewPort   = jScrollPane.getViewport;
jEditbox    = jViewPort.getComponent(0);
%set(jScrollPane,&#039;HorizontalScrollBarPolicy&#039;, jScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
%set(jScrollPane,&#039;VerticalScrollBarPolicy&#039;, jScrollPane.VERTICAL_SCROLLBAR_NEVER);
set(jScrollPane,&#039;HorizontalScrollBarPolicy&#039;, 32);
set(jScrollPane,&#039;VerticalScrollBarPolicy&#039;, 21);
jEditbox.setWrapping(false);
catch
disp(lasterr)
r = false;
end
&lt;/pre&gt;I used the integer-values for the scrollbars because the named constants are not part of the Java object.Problem: when I call the above function from the button-callback, then it works. But this is not what I want, I want that when the figure is made visible, the scrollbars are automatically OK. So what I tried:1) call &#039;set_edit_props&#039; from edit create-callback:jScrollPane =
handle: 0-by-0
No appropriate method or public field getViewport for class handle.handle.2) call &#039;set_edit_props&#039; after a 2 secs delay (timer-object) started within edit create-callback (try to let everything become visible before access is requested):jScrollPane =
handle: 1-by-0
No appropriate method or public field getViewport for class handle.handle.3) call &#039;set_edit_props&#039; from OpeningFcn: result as with 2)4) call &#039;set_edit_props&#039; via timer from OpeningFcn: result as with 1) (!)Nothing works. Maybe you have some ideas....Regards,Jeroen</description> <content:encoded><![CDATA[<p>Hi Yair,</p><p>It works only half for me, hopefully you can point me in the correct direction. Currently working with :</p><p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br
/> MATLAB Version 7.4.0.287 (R2007a)<br
/> Operating System: Microsoft Windows XP Version 5.1 (Build 2600: Service Pack 3)<br
/> Java VM Version: Java 1.5.0_07 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode<br
/> &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;</p><p>For testing I put a button and edit on a figure in GUIDE, I have a function to change the properties of the edit:</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;"><span style="color: #0000FF;">function</span> r = set_edit_props<span style="color: #080;">&#40;</span><span style="color: #0000FF;">varargin</span><span style="color: #080;">&#41;</span>
&nbsp;
r = <span style="color: #0000FF;">true</span>;
<span style="color: #0000FF;">try</span>
    h           = <span style="color: #0000FF;">findobj</span><span style="color: #080;">&#40;</span><span style="color:#A020F0;">'Tag'</span>, <span style="color:#A020F0;">'edit2'</span><span style="color: #080;">&#41;</span>;
    jScrollPane = findjobj<span style="color: #080;">&#40;</span>h<span style="color: #080;">&#41;</span>;
    jViewPort   = jScrollPane.<span style="">getViewport</span>;
    jEditbox    = jViewPort.<span style="">getComponent</span><span style="color: #080;">&#40;</span><span style="color: #33f;">0</span><span style="color: #080;">&#41;</span>;
    <span style="color: #228B22;">%set(jScrollPane,'HorizontalScrollBarPolicy', jScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);</span>
    <span style="color: #228B22;">%set(jScrollPane,'VerticalScrollBarPolicy', jScrollPane.VERTICAL_SCROLLBAR_NEVER);</span>
    <span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>jScrollPane,<span style="color:#A020F0;">'HorizontalScrollBarPolicy'</span>, <span style="color: #33f;">32</span><span style="color: #080;">&#41;</span>;
    <span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>jScrollPane,<span style="color:#A020F0;">'VerticalScrollBarPolicy'</span>, <span style="color: #33f;">21</span><span style="color: #080;">&#41;</span>;
    jEditbox.<span style="">setWrapping</span><span style="color: #080;">&#40;</span><span style="color: #0000FF;">false</span><span style="color: #080;">&#41;</span>;
<span style="color: #0000FF;">catch</span>
    <span style="color: #0000FF;">disp</span><span style="color: #080;">&#40;</span><span style="color: #0000FF;">lasterr</span><span style="color: #080;">&#41;</span>
    r = <span style="color: #0000FF;">false</span>;
<span style="color: #0000FF;">end</span></pre></div></div><p>I used the integer-values for the scrollbars because the named constants are not part of the Java object.</p><p>Problem: when I call the above function from the button-callback, then it works. But this is not what I want, I want that when the figure is made visible, the scrollbars are automatically OK. So what I tried:</p><p>1) call &#8216;set_edit_props&#8217; from edit create-callback:</p><p>jScrollPane =</p><p> handle: 0-by-0</p><p>No appropriate method or public field getViewport for class handle.handle.</p><p>2) call &#8216;set_edit_props&#8217; after a 2 secs delay (timer-object) started within edit create-callback (try to let everything become visible before access is requested):</p><p>jScrollPane =</p><p> handle: 1-by-0</p><p>No appropriate method or public field getViewport for class handle.handle.</p><p>3) call &#8216;set_edit_props&#8217; from OpeningFcn: result as with 2)</p><p>4) call &#8216;set_edit_props&#8217; via timer from OpeningFcn: result as with 1) (!)</p><p>Nothing works. Maybe you have some ideas&#8230;.</p><p>Regards,</p><p> Jeroen</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-9326</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Sat, 24 Apr 2010 18:03:41 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-9326</guid> <description>@Camilo - it would help to know which Matlab version, Java version and OS you have - in short, the output of the &lt;b&gt;&lt;i&gt;ver&lt;/i&gt;&lt;/b&gt; function in your Matlab command prompt.In the meantime, you can try Carrie&#039;s solution above - simply use the number 30 instead of jScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED</description> <content:encoded><![CDATA[<p>@Camilo &#8211; it would help to know which Matlab version, Java version and OS you have &#8211; in short, the output of the <b><i>ver</i></b> function in your Matlab command prompt.</p><p>In the meantime, you can try Carrie&#8217;s solution above &#8211; simply use the number 30 instead of jScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED</p> ]]></content:encoded> </item> <item><title>By: camilo</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-9281</link> <dc:creator>camilo</dc:creator> <pubDate>Fri, 23 Apr 2010 15:21:48 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-9281</guid> <description>i tryed this code, for horizontal scrollbar,
&lt;pre lang=&quot;matlab&quot;&gt;
jViewPort = jScrollPane.getViewport;
jEditbox = jViewPort.getComponent(0);
jEditbox.setWrapping(false);  % do *NOT* use set(...)!!!
newPolicy = jScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
set(jScrollPane,&#039;HorizontalScrollBarPolicy&#039;,newPolicy);
&lt;/pre&gt;but am getting this error:
?? No appropriate method, property, or field HORIZONTAL_SCROLLBAR_AS_NEEDED for class javahandle_withcallbacks.com.mathworks.hg.peer.utils.UIScrollPane.Error in ==&gt; blblblb at 8
newPolicy = jScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;</description> <content:encoded><![CDATA[<p>i tryed this code, for horizontal scrollbar,</p><div
class="wp_syntax"><div
class="code"><pre class="matlab" style="font-family:monospace;">jViewPort = jScrollPane.<span style="">getViewport</span>;
jEditbox = jViewPort.<span style="">getComponent</span><span style="color: #080;">&#40;</span><span style="color: #33f;">0</span><span style="color: #080;">&#41;</span>;
jEditbox.<span style="">setWrapping</span><span style="color: #080;">&#40;</span><span style="color: #0000FF;">false</span><span style="color: #080;">&#41;</span>;  <span style="color: #228B22;">% do *NOT* use set(...)!!!</span>
newPolicy = jScrollPane.<span style="">HORIZONTAL_SCROLLBAR_AS_NEEDED</span>;
<span style="color: #0000FF;">set</span><span style="color: #080;">&#40;</span>jScrollPane,<span style="color:#A020F0;">'HorizontalScrollBarPolicy'</span>,newPolicy<span style="color: #080;">&#41;</span>;</pre></div></div><p>but am getting this error:<br
/> ?? No appropriate method, property, or field HORIZONTAL_SCROLLBAR_AS_NEEDED for class javahandle_withcallbacks.com.mathworks.hg.peer.utils.UIScrollPane.</p><p>Error in ==> blblblb at 8<br
/> newPolicy = jScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;</p> ]]></content:encoded> </item> <item><title>By: Carrie Kimbel</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-7075</link> <dc:creator>Carrie Kimbel</dc:creator> <pubDate>Wed, 10 Feb 2010 17:30:24 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-7075</guid> <description>Sorry.  Just a typo in my post.  I tried ...AS_NEEDED and ..._NEVER in my code - no luck, but the numbers work great.  Thanks.</description> <content:encoded><![CDATA[<p>Sorry.  Just a typo in my post.  I tried &#8230;AS_NEEDED and &#8230;_NEVER in my code &#8211; no luck, but the numbers work great.  Thanks.</p> ]]></content:encoded> </item> <item><title>By: Yair Altman</title><link>http://undocumentedmatlab.com/blog/customizing-listbox-editbox-scrollbars/#comment-7073</link> <dc:creator>Yair Altman</dc:creator> <pubDate>Wed, 10 Feb 2010 16:50:48 +0000</pubDate> <guid
isPermaLink="false">http://undocumentedmatlab.com/?p=994#comment-7073</guid> <description>@Carrie - it&#039;s VERTICAL_SCROLLBAR_NEVER (without the &quot;_AS_&quot;). Only VERTICAL_SCROLLBAR_AS_NEEDED has an &quot;_AS_&quot;.</description> <content:encoded><![CDATA[<p>@Carrie &#8211; it&#8217;s VERTICAL_SCROLLBAR_NEVER (without the &#8220;_AS_&#8221;). Only VERTICAL_SCROLLBAR_AS_NEEDED has an &#8220;_AS_&#8221;.</p> ]]></content:encoded> </item> </channel> </rss>

<!-- W3 Total Cache: Minify debug info:
Engine:             disk: basic
Theme:              b7666
Template:           single
-->
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: undocumentedmatlab.com @ 2012-05-18 22:25:16 -->

<!-- W3 Total Cache: Page cache debug info:
Engine:             disk: enhanced
Cache key:          blog/customizing-listbox-editbox-scrollbars/feed/_index.xml_gzip
Caching:            enabled
Status:             not cached
Creation Time:      0.816s
Header info:
X-Pingback:         http://undocumentedmatlab.com/blog/xmlrpc.php
Set-Cookie:         wpgb_visit_last_php-default=1337405115; expires=Sun, 19-May-2013 05:25:15 GMT; path=/
Link:               <http://undocumentedmatlab.com/?p=994>; rel=shortlink
Content-Type:       text/xml; charset=UTF-8
Last-Modified:      Sat, 19 May 2012 05:25:16 GMT
Vary:               Accept-Encoding, Cookie
Expires:            Sat, 19 May 2012 06:25:16 GMT
Pragma:             public
Cache-Control:      public, must-revalidate, proxy-revalidate
Etag:               8521c940fdf19f22ae0c8bab97be5c7d
Content-Encoding:   gzip
-->
