Solved

Changes of label Font properties(BCB 4.0)

Posted on 2002-05-16
3
685 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

730 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