フィルターのクリア

How to remove dotted border from pushbutton created by uicontrol function?

3 ビュー (過去 30 日間)
Prashant Birajdar
Prashant Birajdar 2015 年 12 月 23 日
コメント済み: Prashant Birajdar 2015 年 12 月 31 日
Hello Sir, I am developing GUI in Matlab R2015b programmatically. I want to remove the dotted border around the pushbutton created using uicontrol function. The following message box is created by me using figure and uicontrol
Whenever I click on push button this dotted border will appear and I want to remove them.
  4 件のコメント
Prashant Birajdar
Prashant Birajdar 2015 年 12 月 24 日
Hello Walter, I am using the Microsoft Windows 7 professional.
Prashant Birajdar
Prashant Birajdar 2015 年 12 月 31 日
Hello Walter, The border is removed automatically after deployment of application. This border is appear only when you are developing the application and run in matlab.

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2015 年 12 月 24 日
The dotted line marks the GUI obejct, which has the current focus. This feature is controlled by the operating system and it belongs to the standard user interface. It appears also, when you use Tab to move the selection such that you know, which object is affected by pressing teh space key. Are you sure you want to remove it?
If you are sure that the user is not confused by changing the default behavior of the GUI elements, you can set the focus back to the current figure in the button's callback. This should be performed by figure(gcbf), but unfortuantely this command does not work as announced in the documentation since Matlab 5.0. (@MathWorks: Come on!)
As workaround you can call this function from the uicontrol 's callback:
function FocusToFig(ObjH, EventData) %#ok<INUSD>
% Move focus to parent figure
% FocusToFig(ObjH, [optionalUnsuedEventData])
% Tested: Matlab 6.5, 7.7, 7.8, 7.13, 8.6, WinXP/32, Win7/64
% Author: Jan Simon, Heidelberg, (C) 2009-2015
if any(ishandle(ObjH)) % Catch no handle and empty ObjH
FigH = ancestor(ObjH, 'figure');
% Work-around
if strcmpi(get(ObjH, 'Type'), 'uicontrol')
set(ObjH, 'Enable', 'off');
drawnow;
set(ObjH, 'Enable', 'on');
pause(0.02); % Give the re-enabled control a chance to be rendered
end
% Methods according to the documentation (does not move the focus for
% keyboard events under Matlab 5.3, 6.5, 2008b, 2009a, 2011b, 2015b):
figure(FigH);
set(0, 'CurrentFigure', FigH);
end
Please send a bug report to TMW concerning "figure(FigH)". I've done it too many times without success already. :-(

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by