controlling background color of selected uicontrol popup?
Show older comments
I can create a uicontrol('Style','popup') with a 'backgroundcolor'. This works and the color is the one I chose. However, as soon as I select any value, the background color goes to a grayish, with the text in the foreground color I have set. The selected pop-up entry does not use the background color.
Is there a way to control the background color of a selected pop-up entry?
(I am trying to color-code my uicontrols according to the major class of functionality they have within the terms of my program. Although I could in theory do so just by adjusting their text foreground colors, the area of the text compared to the area of the control is relatively small and the color coding of the text is not nearly as distinguishable as color coding the background.)
3 Comments
Walter Roberson
on 10 Feb 2011
Jan
on 15 Feb 2011
Does REFRESH(FigHandle) help?
Walter Roberson
on 18 Feb 2011
Accepted Answer
More Answers (2)
Matt Fig
on 28 Jan 2011
Things seem to work here as you wish, unless I misunderstand you.
uicontrol('Style','popup','backgroundcol',[.9 .7 .3],'string',{'P';'Y';'F'})
This creates a popupmenu with an orange-ish bgc. After I select any of the three strings, the bgc is the same.
6 Comments
Walter Roberson
on 28 Jan 2011
Jan
on 29 Jan 2011
And this is exactly what my suggested method does: Disable the uicontrol temporarily, what forces a redraw. The moving of the focus is just a side-effect. Did you try my function?
Walter Roberson
on 29 Jan 2011
Edited: Walter Roberson
on 2 Aug 2021
Walter Roberson
on 29 Jan 2011
Walter Roberson
on 29 Jan 2011
Jan
on 29 Jan 2011
Fine. Is your problem solved then?
Daniele Scaranari
on 31 Oct 2018
0 votes
figure(gcf) works correctly in Matlab R2017a, Windows10.
Categories
Find more on File Operations in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!