app.UITable_periodical.Data
s = uistyle;
s.FontWeight = "bold";
if i set s.FontWeight = "bold" or not is equal..i don't see character bold

 Réponse acceptée

Voss
Voss le 15 Août 2023
To make a uistyle take effect, you must use addStyle to associate the style with the component (i.e., the uitable in this case).
% create a uistyle:
s = uistyle; % these two line could more succinctly be written as
s.FontWeight = "bold"; % s = uistyle('FontWeight','bold');
% associate s with a uitable:
addStyle(app.UITable_periodical,s)

7 commentaires

sorry I posted I text partially because there were other conditions.. I wrote this in the code:
[app.UITable_periodical.Data,idxNeg,idxPos]=Table_Periodical_Struct(app.Eq,app.PeriodicalDropDown.Value);
app.UITable_periodical.ColumnName = {'Day','P&L','Month','P&L','Year','P&L'};
s = uistyle;
s.FontWeight = "bold";
s.FontColor='red';
addStyle(app.UITable_periodical,s,'cell',idxNeg);
s.FontColor=[0 0.5 0];
addStyle(app.UITable_periodical,s,'cell',idxPos);
Voss
Voss le 15 Août 2023
How are idxNeg and idxPos defined?
are coordinated to color the boxes
[row,column]=find(prof<0);
column=column+1;
idxNeg=[row,column];
[row,column]=find(prof>0);
column=column+1;
idxPos=[row,column];
Voss
Voss le 15 Août 2023
Looks like it's working. Positive and negative values are bold, positive values in green and negative in red. Right?
aldo
aldo le 15 Août 2023
Modifié(e) : aldo le 15 Août 2023
ah :D
I wanted to make each word/number bold regardless of whether it was colored
I extended the bold only to the colored numbers :(
Voss
Voss le 15 Août 2023
Ah, ok. You can make everything bold in a couple of different ways. I would probably make a new uistyle just for the bold FontWeight, and apply it everywhere (e.g., every column) you want to be bold. And let the color uistyles be just for FontColor and apply only to specific cells. (Any row/column/cell can have multiple uistyles applied to it.)
I'm sure you can get it from here, but if you need any help, let me know.
aldo
aldo le 15 Août 2023
oky thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Centre d'aide et File Exchange

Question posée :

le 15 Août 2023

Commenté :

le 15 Août 2023

Community Treasure Hunt

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

Start Hunting!

Translated by