Comments on: uisplittool & uitogglesplittool https://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool Charting Matlab's unsupported hidden underbelly Wed, 27 Nov 2019 11:18:32 +0000 hourly 1 https://wordpress.org/?v=4.4.1 By: Kees de Kapperhttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-404499 Fri, 07 Apr 2017 07:12:15 +0000 https://undocumentedmatlab.com/?p=1994#comment-404499 Dear Yair,

Thank you for your extensive descriptions.
However, I was wondering if it is possible to add icons to the jMenuItem in the uitogglesplittool or uisplittool?
And secondly, is there a straight forward method to obtain the index of the selected jMenuItem.

Many thanks for your consideration.
All the Best,
Kees

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-390133 Thu, 06 Oct 2016 20:34:35 +0000 https://undocumentedmatlab.com/?p=1994#comment-390133 Sounds like an EDT issue. Try adding drawnow and/or pause(0.1).

]]>
By: Christinahttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-390132 Thu, 06 Oct 2016 20:30:58 +0000 https://undocumentedmatlab.com/?p=1994#comment-390132 I forgot to mention that if I go into debug mode and step through each line of code, then it works perfectly. When I let it run on its own is when it crashes. Not sure if that makes a difference.

]]>
By: Christinahttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-390129 Thu, 06 Oct 2016 19:55:30 +0000 https://undocumentedmatlab.com/?p=1994#comment-390129 I’m using this capability with 2013a but am having a problem with it crashing. I tried putting my code in the GUIDE OpeningFcn as well as the OutputFcn but get the same results. My code is as follows:

color = java.awt.Color(0,0,0);
 
% hToolbar = findall(gcf,'tag','hToolbar');
jToolbar = get(get(handles.hToolbar,'JavaContainer'),'ComponentPeer');
 
% Create a splittool for different options
hLayout = uisplittool('parent',handles.hToolbar);       % uisplittool
 
% Load the icon
icon = fullfile(pwd,'icons','Icon.gif');
[cdata,map] = imread(icon);
map(find(map(:,1)+map(:,2)+map(:,3)==3)) = NaN;
 
set(hLayout, 'tag','testingButton','cdata',ind2rgb(cdata,map), 'tooltip','Layout Types','Separator','on', ...
           'ClickedCallback',[]);
 
jLayout = get(hLayout,'JavaContainer');
jLayoutMenu = jLayout.getMenuComponent;
imageToolkit = java.awt.Toolkit.getDefaultToolkit;
for layoutInd = 1:3
    jMenuItem = handle(jLayoutMenu.add(['Layout ' num2str(layoutInd)]),'CallbackProperties');
    set(jMenuItem,'ActionPerformedCallback',{@changeLayout,layoutInd});
    myIcon = fullfile(pwd,'icons',['layout' num2str(layoutInd) '.gif']);
    jMenuItem.setIcon(javax.swing.ImageIcon(imageToolkit.createImage(myIcon)));
    jMenuItem.setBackground(color);
end
 
jToolbar.revalidate;

I think I’ve narrowed it down that the following line of code is what is causing it to crash:

jLayout = get(hLayout,'JavaContainer');

Any suggestions on how to remedy this??

Thanks!

]]>
By: Customizing the standard figure toolbar, menubar | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-140001 Wed, 09 Jan 2013 20:12:34 +0000 https://undocumentedmatlab.com/?p=1994#comment-140001 […] The idea here is to replace the standard toolbar “Open File” pushbutton with a new uisplittool button that will contain the MRU list in its picker-menu. […]

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-54896 Wed, 24 Aug 2011 20:33:14 +0000 https://undocumentedmatlab.com/?p=1994#comment-54896 @cK – Transparency only works in GUI controls. It is unfortunately not supported by Matlab’s image function that displays the image in Matlab plot axes.

]]>
By: cKhttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-54832 Wed, 24 Aug 2011 02:55:06 +0000 https://undocumentedmatlab.com/?p=1994#comment-54832 I was curious to know if there is a way to retain transparency of png images or even convert white pixels of a logo image into transparent background (it looks sweet on GUIs). I tried the following on a gif image and the image still gave a white background. Why doesnt it work?

[cdata,map] = imread('logo.gif');
map(find(map(:,1)+map(:,2)+map(:,3)==3)) = NaN;
% Convert into 3D RGB-space
cdata2 = ind2rgb(cdata,map);
image(cdata2);
]]>
By: Danhttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-25802 Tue, 14 Dec 2010 20:57:17 +0000 https://undocumentedmatlab.com/?p=1994#comment-25802 out of topic, but thank you for your efforts.

You are of great help to many Matlab practitioners!

Best regards

Dan

]]>
By: Yogeshhttps://undocumentedmatlab.com/blog_old/uisplittool-uitogglesplittool#comment-25175 Thu, 09 Dec 2010 17:51:45 +0000 https://undocumentedmatlab.com/?p=1994#comment-25175 Thanks. I find this useful.

]]>