Solved

Changes of label Font properties(BCB 4.0)

Posted on 2002-05-16
3
675 Views
Last Modified: 2013-12-03
This one is really going to show that I have less than 2 years of C++ programming experiance....

Borland C++ Builder 4.0 pro  

Here is a code snippet from a switch statement that is supposed to change the font color and style (bold) depending on the value of an editbox variable.

case 1:
      {
         ...// some stuff
         if(water == 2)
         {
            water = 200;
            labelDiagWater->Font->Style = fsBold;
            labelDiagWater->Font->Color = clYellow;
         }
         ...// other stuff

This brings up:
[C++ Error]Main.cpp[167]: E2034 Cannot convert 'TFontStyle' to 'TFontStyles'.

If I comment out the fsBold line, the program runs fine and changes the font color to yellow when needed.  I cannot get the font to change to Bold.  I have tried all sorts of things, and the Borland help files, as great as they are, do not seem to be giving me the answer that I need.

Thanks...
0
Comment
Question by:LordDamein
  • 2
3 Comments
 
LVL 2

Expert Comment

by:mirtol
ID: 7013673
Yep, that's because Font->Style is a Set

To make bold use:
labelDiagWater->Font->Style << fsBold;

To make unbold use:
labelDiagWater->Font->Style >> fsBold;



0
 
LVL 2

Accepted Solution

by:
mirtol earned 50 total points
ID: 7013680
Oh and to just set the style to bold (no underline, italic etc) use:

labelDiagWater->Font->Style = TFontStyles() << fsBold;
0
 

Author Comment

by:LordDamein
ID: 7014108
Well, I learned something new today!!!

Thanks...
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now