tooltip in App Designer

조회 수: 37 (최근 30일)
Pappu Murthy
Pappu Murthy 2018년 11월 2일
댓글: Cris LaPierre 2019년 11월 15일
In my App designer for one of the panels I defined a tooltip. Now I want to get rid of it. Everytime i highlight and get rid of it in Code design view, I get a long series of read error messages but the tool string does not get removed. I can't go into code view and delete the line for tooltip string either as it is grayed out. So my question is how do I completely get rid of it without deleting the panel altogether and start over again?
  댓글 수: 6
Cris LaPierre
Cris LaPierre 2018년 11월 23일
What are you setting as the tip? I see this in your error messages:
Error setting property 'Tooltip' of class 'Panel':
UIStrings data type does not support numeric values.
Pappu Murthy
Pappu Murthy 2018년 11월 23일
I am just setting a 'string' as Tool tip and it shows correctly. But when I try to delete it by 'highlighting' it and 'backspace' it gives all those errors.
here is the complete code:
classdef MyTest2 < matlab.apps.AppBase
% Properties that correspond to app components
properties (Access = public)
UIFigure matlab.ui.Figure
TestingPanel matlab.ui.container.Panel
GOButton matlab.ui.control.Button
end
% App initialization and construction
methods (Access = private)
% Create UIFigure and components
function createComponents(app)
% Create UIFigure
app.UIFigure = uifigure;
app.UIFigure.Position = [100 100 640 480];
app.UIFigure.Name = 'UI Figure';
% Create TestingPanel
app.TestingPanel = uipanel(app.UIFigure);
app.TestingPanel.Tooltip = {'adfdaf'; ''};
app.TestingPanel.Title = 'Testing..';
app.TestingPanel.FontWeight = 'bold';
app.TestingPanel.FontSize = 16;
app.TestingPanel.Position = [51 226 260 221];
% Create GOButton
app.GOButton = uibutton(app.TestingPanel, 'push');
app.GOButton.Position = [80 123 100 22];
app.GOButton.Text = 'GO';
end
end
methods (Access = public)
% Construct app
function app = MyTest2
% Create and configure components
createComponents(app)
% Register the app with App Designer
registerApp(app, app.UIFigure)
if nargout == 0
clear app
end
end
% Code that executes before app deletion
function delete(app)
% Delete UIFigure when app is deleted
delete(app.UIFigure)
end
end
end

댓글을 달려면 로그인하십시오.

채택된 답변

Cris LaPierre
Cris LaPierre 2018년 11월 23일
편집: Cris LaPierre 2018년 11월 23일
I see it now. This looks like a bug to me. I'll report it. If you do not want the tooltip to appear, the best workaround I can think of is to add the following to your startupFcn Callback.
app.Panel.Tooltip = '';
Of course, replace Panel with whatever you named it.
  댓글 수: 5
Walter Roberson
Walter Roberson 2019년 2월 7일
hasproperty() before doing the assignment .
Daniel Bailey
Daniel Bailey 2019년 4월 12일
편집: Daniel Bailey 2019년 4월 12일
@Jake Shea & @Robert:
As far as backwards compatibility goes. I was able to remove blank tooltips from the code by opening it in a version that predates 'Tooltips' release.
To be exact with what I did:
Steps 1-3 completed in MATLAB 2019a
1) Deleted all Tooltip text
2) Save Copy As
3) Save as type: MATLAB 2017b APP (*.mlapp)
Steps 4-5 completed in MATLAB 2017b
4) Opened MATLAB 2017b
5) Right clicked to open *.mlapp file
At this point all of the tooltips had dissapeared from the code.
Interestingly enough, only saving the file as an earlier version did NOT fix the problem. Only at the point that the code was opened in app designer did the app.*.Tooltip = {''}; code dissapear.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Johan
Johan 2019년 11월 15일
Anybody know if this bug has been fixed in the newest version of Matlab?
2018B definitely still has this problem.
  댓글 수: 1
Cris LaPierre
Cris LaPierre 2019년 11월 15일
This should be fixed in 2019a.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by