Skip to content

Commit dc39a0d

Browse files
author
Pavel Trnka
committed
Hide window handle to avoid conflicts with gcf, gca, etc.
1 parent 2d07e73 commit dc39a0d

File tree

5 files changed

+29
-3
lines changed

5 files changed

+29
-3
lines changed

MATLAB Snippets.mlappinstall

799 Bytes
Binary file not shown.

MATLAB Snippets.prj

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<deployment-project plugin="plugin.apptool" plugin-version="1.0">
2-
<configuration build-checksum="4215706648" file="C:\work\repo\github\snippets\MATLAB Snippets.prj" location="C:\work\repo\github\snippets" name="MATLAB Snippets" target="target.mlapps" target-name="Package App">
2+
<configuration build-checksum="1803816239" file="C:\work\repo\github\snippets\MATLAB Snippets.prj" location="C:\work\repo\github\snippets" name="MATLAB Snippets" target="target.mlapps" target-name="Package App">
33
<param.appname>MATLAB Snippets</param.appname>
44
<param.authnamewatermark>Pavel Trnka</param.authnamewatermark>
55
<param.email>pavel@trnka.name</param.email>
@@ -94,8 +94,15 @@ Snippets definition uses syntax compatible with &lt;a href="https://code.visuals
9494
</build-deliverables>
9595
<workflow />
9696
<matlab>
97-
<root>C:\Program Files\MATLAB\R2019a</root>
98-
<toolboxes />
97+
<root>C:\Program Files\MATLAB\R2019b</root>
98+
<toolboxes>
99+
<toolbox name="neuralnetwork" />
100+
</toolboxes>
101+
<toolbox>
102+
<neuralnetwork>
103+
<enabled>true</enabled>
104+
</neuralnetwork>
105+
</toolbox>
99106
</matlab>
100107
<platform>
101108
<unix>false</unix>

dialogs/insertSnippetAboutDlg.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@ function insertSnippetAboutDlg(versionStr)
2828
'Pavel Trnka (pavel@trnka.name)<br>' ...
2929
'Version: ' versionStr '</body></html>'];
3030
jLabel = javaObjectEDT('javax.swing.JLabel',labelStr);
31+
% ---
32+
oldWarn = warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
33+
warning('off','MATLAB:ui:javacomponent:FunctionToBeRemoved');
3134
javacomponent(jLabel,[78,10,380-78-10,48],hPanel);
35+
warning(oldWarn);
36+
% ---
3237

3338
uicontrol(...
3439
'style', 'edit', ...

insertSnippet.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ function insertSnippet()
1313
optionsFileName = 'insertSnippetOptions.mat';
1414
versionStr = '1.0';
1515

16+
% --- Temporarily enable hidden handles visibility
17+
set(0,'ShowHiddenHandles','on');
18+
1619
% --- Search for the hidden App window and show it if it exists ----------------
1720
if showHiddenWindow(windowTag)
1821
return
@@ -44,6 +47,9 @@ function insertSnippet()
4447
% --- Initialize and show the GUI ----------------------------------------------
4548
initializeGUI;
4649

50+
% --- Restore hidden handles visibility
51+
set(0,'ShowHiddenHandles','remove');
52+
4753

4854
% ==============================================================================
4955

@@ -65,6 +71,7 @@ function createFigure()
6571
'Name', 'Insert Snippet', ...
6672
'Tag', windowTag, ...
6773
'Visible', 'off', ...
74+
'HandleVisibility', 'off', ... hide the window to gca, gcf, ...
6875
'KeyPressFcn', @figureKeyPressFcn, ...
6976
'DeleteFcn', @figureDeleteFcn, ...
7077
'SizeChangedFcn', @figureSizeChangedFcn, ...
@@ -103,7 +110,13 @@ function createFigure()
103110
codeType = com.mathworks.widgets.text.mcode.MLanguage.M_MIME_TYPE;
104111
h.CodePane.setContentType(codeType);
105112
jScrollPane = com.mathworks.mwswing.MJScrollPane(h.CodePane);
113+
% ---
114+
oldWarn = warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
115+
warning('off','MATLAB:ui:javaframe:PropertyToBeRemoved');
116+
warning('off','MATLAB:ui:javacomponent:FunctionToBeRemoved');
106117
[~,h.CodePaneContainer] = javacomponent(jScrollPane,[0 0 0 0],h.Fig);
118+
warning(oldWarn);
119+
% ---
107120
% --- Add code pane to the <TAB> cycle
108121
h.CodePane.setFocusable(true);
109122
h.CodePane.putClientProperty('TabCycleParticipant', true);

utils/findjobj_fast.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
% Based on Yair Altman "findjobj"
33
drawnow; pause(0.02);
44
oldWarn = warning('off','MATLAB:HandleGraphics:ObsoletedProperty:JavaFrame');
5+
warning('off','MATLAB:ui:javaframe:PropertyToBeRemoved');
56
jframe = get(hFig,'JavaFrame');
67
warning(oldWarn);
78
jContainer = jframe.getFigurePanelContainer.getComponent(0);

0 commit comments

Comments
 (0)