controlling background color of selected uicontrol popup?
Afficher commentaires plus anciens
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 commentaires
Walter Roberson
le 10 Fév 2011
Jan
le 15 Fév 2011
Does REFRESH(FigHandle) help?
Walter Roberson
le 18 Fév 2011
Réponse acceptée
Plus de réponses (2)
Matt Fig
le 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 commentaires
Walter Roberson
le 28 Jan 2011
Jan
le 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
le 29 Jan 2011
Modifié(e) : Walter Roberson
le 2 Août 2021
Walter Roberson
le 29 Jan 2011
Walter Roberson
le 29 Jan 2011
Jan
le 29 Jan 2011
Fine. Is your problem solved then?
Daniele Scaranari
le 31 Oct 2018
0 votes
figure(gcf) works correctly in Matlab R2017a, Windows10.
Catégories
En savoir plus sur File Operations dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!