GUI Button Highlights in Blue (When Clicked)

Hi all,
I have a simple GUI with 3 buttons and 2 labels. When I click a button, Matlab automatically highlights it in this light blue metallic color. I want to deactivate this automatic highlighting mechanism. Anybody know how to do this?
Jeff

回答 (1 件)

Paulo Silva
Paulo Silva 2011 年 9 月 8 日

0 投票

See if the button has some code on his ButtonDownFcn, if there's some code in it remove it, also see the SelectionHighlight, turn it off

8 件のコメント

Sean de Wolski
Sean de Wolski 2011 年 9 月 8 日
Could it also just be an OS setting?
Paulo Silva
Paulo Silva 2011 年 9 月 8 日
I don't know Sean, it doesn't happen with my MATLAB
Jeff please check what you get by putting the next code on that pushbutton callback, execute the GUI and click on the pushbutton
get(HandlePushbutton)
%replace HandlePushbutton with the handle for the button that becomes blue
Copy what you get in the command line and show it to us
Jeff
Jeff 2011 年 9 月 8 日
Sorry let me clarify, and if you still want me to go through the steps above I will do so.
I have disabled SelectionHighlight and it doesn't change anything. The button is actually highlighted in blue even if I simply hover the cursor over the button. When I move the cursor away, the button fades back to its regular background color.
Sean de Wolski
Sean de Wolski 2011 年 9 月 8 日
Is the GUI manually created or written in GUIDE? Did you write the code for the GUI?
Jeff
Jeff 2011 年 9 月 8 日
Also, I'm running Windows 7. I notice that other buttons in the Windows menus are highlighted in the same color when I hover my cursor over them.
Jeff
Jeff 2011 年 9 月 8 日
Sean de:
Most of it written in GUIDE. I added some variables and control logic within the callback functions and GUI initialization.
Sean de Wolski
Sean de Wolski 2011 年 9 月 8 日
probably is an OS setting. I haven't used Windows 7 so I can't advise. If you make a second button or a second GUI or even just a questdlg does it occur?
>> questdlg('Does it occur below?','Test','yes','no')
Jeff
Jeff 2011 年 9 月 8 日
Yes. It's an OS setting I think. I've tried going into advanced system settings -> performance settings -> unchecked "use visual styles on windows and buttons", and this eliminates the highlight problem. However, this also makes the rest of the GUI look tacky and the buttons have no borders at all, which makes them look like labels. And when you click on a button, a dotted black border surrounds the button which is also distracting. Anyone know how to disable just the Win 7 highlight visual effect but keep everything else?

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

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

タグ

質問済み:

2011 年 9 月 8 日

Community Treasure Hunt

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

Start Hunting!

Translated by