set(h, 'BackgroundColor', 'Black') - Not working in Linux

Hi,
I'm making a gui with several edittexts. I would like these to have a black background and white text. First I tried to simply set this in the GUI editor (Guide), but it didn't seem to work, since they start out being disabled. Then i tried adding a function which adjust them, when they are activated. The code goes like this:
set(handles.editXoffset, 'BackgroundColor', 'Black',...
'ForegroundColor', 'White');
This works fine on windows machines, but on Linux, both background color and font color is shown as white. Looking in the properties, using:
get(hObject)
...in the edittexts callback, it shows this:
BackgroundColor = [0 0 0]
...
ForegroundColor = [1 1 1]
...
So it seems to be getting what I tell it, but it just don't show. What am I doing wrong here?

2 comentarios

Daniel Shub
Daniel Shub el 11 de Abr. de 2012
Is what you are doing similar to executing uicontrol('Style', 'Edit', 'String', 'Hello', 'BackgroundColor', 'Black', 'ForegroundColor', 'White'); in the command window?
Jakob Sørensen
Jakob Sørensen el 13 de Abr. de 2012
Pretty much I guess. I'm just changing settings of an already existing uicontrol, rather than creating a new one.

Iniciar sesión para comentar.

 Respuesta aceptada

Jan
Jan el 11 de Abr. de 2012

0 votos

The operating system can override the specified colors, and obviously it does under your Linux platform. Which Matlab and OS version are you using?

1 comentario

Jakob Sørensen
Jakob Sørensen el 12 de Abr. de 2012
I'm not 100% sure, since I'm not near those computers right now. But I think it's Ubuntu 10.x and Matlab R2010a.

Iniciar sesión para comentar.

Más respuestas (1)

Daniel Shub
Daniel Shub el 15 de Abr. de 2012
If I run
uicontrol('Style', 'Edit', 'String', 'Hello', 'BackgroundColor', 'Black', 'ForegroundColor', 'White')
I get a black box with white text with r2011a and Arch Linux.
Are you fonts installed correctly? href=""<http://www.mathworks.com/matlabcentral/answers/1238-font-size-changes-in-figures</a>>

5 comentarios

Jakob Sørensen
Jakob Sørensen el 16 de Abr. de 2012
It seems that the error occurs, not when the uicontrol is created, but rather if I de- and re-activate it.
Daniel Shub
Daniel Shub el 16 de Abr. de 2012
Can you edit the question to provide code with a simple example that reproduces the error?
Jakob Sørensen
Jakob Sørensen el 20 de Abr. de 2012
That seems to be hard. Recently i fixed it using a "fake black" color ([0.1 0.1 0.1]) rather than just black. But then if I disable and enable again, the error occurs again, and this time "fake black" won't fix it. It's pretty damn weird.
Jan
Jan el 20 de Abr. de 2012
I suggest to give up. This will vanish if you install a higher Matlab release. And until then, the users will not suffer. It is impossible to create really nice GUIs with Matlab at all, so this detail is not a killer.
Jakob Sørensen
Jakob Sørensen el 22 de Abr. de 2012
You're probably right. After all im only making a prototype program anyhow. Final versions obviously won't be made in Matlab.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Centro de ayuda y File Exchange.

Preguntada:

el 11 de Abr. de 2012

Community Treasure Hunt

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

Start Hunting!

Translated by