Comments on: Matlab toolstrip – part 3 (basic customization) https://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization Charting Matlab's unsupported hidden underbelly Wed, 20 May 2020 03:01:17 +0000 hourly 1 https://wordpress.org/?v=4.4.1 By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-483100 Sun, 16 Jun 2019 15:26:19 +0000 https://undocumentedmatlab.com/?p=8077#comment-483100 Unfortunately, docking figures into ToolGroups is for some unknown reason (apparently deliberately) prevented by the Matlab Compiler. I am not aware of any workaround for this, at the moment.

]]>
By: Endri K.https://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-473870 Tue, 09 Apr 2019 21:36:24 +0000 https://undocumentedmatlab.com/?p=8077#comment-473870 Hi Yair,

Thank you for all your great posts. They’re all extremely helpful. Could you please help me with an issue I’m facing? I’ve built an application with a ToolGroup and when using the Matlab Application Compiler, in the compiled standalone version, I cannot get hToolGroup.addFigure to dock a new figure in the existing ToolGroup window. I have tried a number of approaches and have been unsuccessful. For this application I am currently using Matlab 2017b.

Thank you,
Endri

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-470505 Tue, 26 Mar 2019 22:14:41 +0000 https://undocumentedmatlab.com/?p=8077#comment-470505 @Arash – the “handles” that you refer to is a simple Matlab struct that contains the GUI handles in separate fields. You can easily create it in your code by assigning each created GUI object (tab, section, column, button etc.) a separate field in the struct, and in the end saving this struct somewhere. You cannot use guidata or guihandles because they only work with figures (not apps), but you can store the handles struct elsewhere e.g. in a global variable, or attached to one of the figures that you dock into your app.

]]>
By: Arash Marashianhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-470500 Tue, 26 Mar 2019 22:04:06 +0000 https://undocumentedmatlab.com/?p=8077#comment-470500 Hi, I have a question, can I use something like “handles”, that we have in GUI?

]]>
By: Chen Wanghttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-457531 Wed, 16 Jan 2019 08:57:05 +0000 https://undocumentedmatlab.com/?p=8077#comment-457531 Thx so much, Collin.
This works 😀

]]>
By: Collin Pecorahttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-457512 Wed, 16 Jan 2019 00:50:29 +0000 https://undocumentedmatlab.com/?p=8077#comment-457512 Chen

I don’t believe the R2016b version has any methods to set position

You can do it through the desktop:

jDesktop = com.mathworks.mlservices.MatlabDesktopServices.getDesktop;
jPos = com.mathworks.widgets.desk.DTLocation.createExternal(uint16(100), uint16(200), uint16(300), uint16(400));
jDesktop.setGroupLocation('A Test', jPos);

Collin

]]>
By: Chen Wanghttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-457472 Tue, 15 Jan 2019 15:12:24 +0000 https://undocumentedmatlab.com/?p=8077#comment-457472 Thx a lot.
i think, it is probably impossible in 16b to set an opening size. i haven’t found any available function :(
but this is not that bad, in 16b the most new futures of toolgroup still work and till now they are enough for me.

Thx u again for ur post :)

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-457453 Tue, 15 Jan 2019 08:30:57 +0000 https://undocumentedmatlab.com/?p=8077#comment-457453 @Chen – 16b is a relatively old release (19a is 5 releases ahead). It is quite possible that the setPosition method was added in one of these later releases. I have not investigated this but it’s possible that there may have been an alternative method in 16b (e.g. setLocation or whatever). You can run methodview(hTG) to check the possibilities, or upgrade to a later Matlab release.

]]>
By: Chen Wanghttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-457451 Tue, 15 Jan 2019 07:59:43 +0000 https://undocumentedmatlab.com/?p=8077#comment-457451 Hi Yair,
thx for your answer :)
i have tried with your suggestion:

hTG = matlab.ui.internal.desktop.ToolGroup('A Test');
hTG.open();
hTG.disableDataBrowser();
jTG = hTG.Peer;
jPos = com.mathworks.widgets.desk.DTLocation.createExternal(uint16(100), uint16(200), uint16(300), uint16(400));
jTG.setPosition(jPos);

but i got error:

Undefined function or variable 'setPosition'.

PS: i’m using Matlab 2016b.

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-457416 Mon, 14 Jan 2019 15:43:14 +0000 https://undocumentedmatlab.com/?p=8077#comment-457416 @Chen – I will discuss positioning and layout in a future post, but for now you can adapt the following script. Note that the positioning uses Java-based coordinates, which is (0,0) at the top-left corner of the screen, and increases downward and to the right, and the position is for the tool-group’s top-left corner. So, position (100,200,800,600) means a 800×600 window whose top-left corner is 100 pixels to the right, and 200 pixels below, the screen’s top-left corner.

% Alternative #1:
hToolGroup = matlab.ui.internal.desktop.ToolGroup();
hToolGroup.setPosition(100, 200, 800, 600);  % x,y,width,height
 
% Alternative #2:
jToolGroup = hToolGroup.Peer;
jPosition = com.mathworks.widgets.desk.DTLocation.createExternal(uint16(100),uint16(200),uint16(800),uint16(600));
jToolGroup.setPosition(jPosition);
]]>
By: chen wanghttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-457415 Mon, 14 Jan 2019 15:20:45 +0000 https://undocumentedmatlab.com/?p=8077#comment-457415 hi Yair,
thx so much for this post.
i have a question: is it possible to manully set an openiong Position or Size for this toolgroup?
i have tried all day and i can not find any Container, which has the ‘position’ properties or something alike.

best regards

]]>
By: Ramiro Massolhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456254 Thu, 20 Dec 2018 19:10:00 +0000 https://undocumentedmatlab.com/?p=8077#comment-456254 hi Yair, thanks for the file you uploaded to the usage examples section.
Happy New Year! best

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456109 Tue, 18 Dec 2018 19:21:34 +0000 https://undocumentedmatlab.com/?p=8077#comment-456109 I added a downloadable file that can be run as-is, at the top of the Usage Examples section.

]]>
By: Ramiro Massolhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456105 Tue, 18 Dec 2018 18:17:30 +0000 https://undocumentedmatlab.com/?p=8077#comment-456105 hi Yair,
i was just trying to reproduce the code you freely publish on your site to test the features of the toolstrip. I guess other readers of your blog will encounter the same issue and I thought you should be aware of it. I’ve already tried opening the toolgroup at other instances with the same effect.

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456099 Tue, 18 Dec 2018 17:24:15 +0000 https://undocumentedmatlab.com/?p=8077#comment-456099 Ramiro – I’m sorry, but I only do private consulting projects as (well) private consulting projects…
Try to display the tool-group at other places within your code, before the end.

]]>
By: Ramiro Massolhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456098 Tue, 18 Dec 2018 17:13:54 +0000 https://undocumentedmatlab.com/?p=8077#comment-456098 hi Yair, I tried that before but i’ve got a weird toolgroup that changed the name and showed no toolstrip at all and was docked to the command window too. I can send you the picture of it if you want. If i open the toolgroup at the start everything looks fine but i can’t add a section.
best

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456087 Tue, 18 Dec 2018 14:56:37 +0000 https://undocumentedmatlab.com/?p=8077#comment-456087 As the error says, you can’t update a toolstrip after it has been rendered (shown). Simply move the hToolGroup.open() command to the end of your script/function.

]]>
By: Ramiro Massolhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456083 Tue, 18 Dec 2018 14:21:37 +0000 https://undocumentedmatlab.com/?p=8077#comment-456083 great. By the way, I tried the code you posted in section 2 of the toolstrips and noticed an error while trying to create a section (“% “Section” cannot be added to “Tab” after toolstrip is rendered.”). This happens all the time when i tried to add a section regardless of the 2 methods you described above. What’s causing this behavior? best

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456074 Tue, 18 Dec 2018 11:11:56 +0000 https://undocumentedmatlab.com/?p=8077#comment-456074 I plan to discuss this in a future post

]]>
By: Ramiro Massolhttps://undocumentedmatlab.com/blog_old/matlab-toolstrip-part-3-basic-customization#comment-456072 Tue, 18 Dec 2018 10:24:07 +0000 https://undocumentedmatlab.com/?p=8077#comment-456072 hi Yair,
first of all, thanks a lot for all the detailed and useful info you wrote about toolstrips. Are you planning to explain how to add and customize toolstrips for figures created with GUIDE?

best
Ramiro

]]>