Copyright © 1998-2015 MultiMedia Soft

TextDescriptor object

Previous pageReturn to chapter overviewNext page

The TextDescriptor object is internally implemented as a COM interface called ITextDescriptor and contains information about the management of texts that will appear over the button surface.

It can be used at Runtime in order to change the settings of any of the following text properties, based upon this object: TextDescrCaption, TextDescrLT, TextDescrCT, TextDescrRT, TextDescrLM, TextDescrRM, TextDescrLB, TextDescrCB, and TextDescrRB (in order to perform changes to texts settings at Design-time take a look to the "How to put text over the button" section).

The TextDescriptor object is implemented through the following properties:

Text

Visible

OffsetX

OffsetY

Angle

TransparentFactor

DoubleSpace

Antialias

SpecialEffect

SpecialEffectFactor

SolidBack

Border

SolidBackShadow

ColorNormal

ColorMouseOver

ColorPressed

ColorSolidBack

ColorBorder

ColorHighlight

ColorShadow

ColorHalo

ColorSolidBackShadow

 

The following code snippets show how to modify this object in your code.  These examples assume that you have placed a control named MyButton on a form or dialog. The point of the code is to change the caption text and color in MyButton at run-time.

Microsoft Visual C++ (4.0, 5.0 and 6.0)

Microsoft Visual C++.NET (2003)

Microsoft Visual Basic (5.0 and 6.0)

Microsoft Visual Basic.NET (2003)

Microsoft Visual C#.NET (2003)

Microsoft Visual J#.NET (2003)

 

Microsoft Visual C++ (4.0, 5.0 and 6.0)

Properties and methods of the control are accessible through the control wrapper class CBtnEnh contained inside the BtnEnh.cpp and BtnEnh.h files: these wrapper files are automatically generated when you insert the control inside your project so, in order to access the wrapper functions, you will have to insert the following line of code somewhere in your code.

 

#include "BtnEnh.h"

 

The TextDescriptor object is defined by the control wrapper class CTextDescriptor contained inside the TextDescriptor.cpp and TextDescriptor.h files: also these wrapper files are automatically generated when you insert the control inside your project so, in order to access this object, you will have to insert the following line of code somewhere in your code.

 

#include "TextDescriptor.h"

 

Here follows the code needed to perform the requested operation of changing the Caption text and color.

// declare a TextDescriptor object

CTextDescriptor text;

 

// init the object with the control's caption TextDescriptor

text = MyButton.GetTextDescrCaption ();

 

// change settings

text.SetText (_T("My Caption"));

text.SetColorNormal (RGB (0, 0, 255));

 

As you can see the access to the TextDescriptor properties Text and ColorNormal are wrapped by the SetText and SetColorNormal functions declared inside the wrapper class CTextDescriptor.

 

Microsoft Visual C++.NET (2003)

With this new development environment, the creation of wrapper classes for ActiveX control is not an easy operation and, while this documentation is being written, it seems to suffer some annoying bug. For this reason 3D Active Button Magic comes with the needed wrapper classes inside the directory "wrappers\cpp.net", created by the product installation package. What you have to do is to add the wrapper classes to your project and use them as described inside the How to use the control in your projects.

As for the previous versions of Visual C++, properties and methods of the control are accessible through the control wrapper class CBtnEnh contained inside the BtnEnh.cpp and BtnEnh.h files: in order to access the wrapper functions, you will have to insert the following line of code somewhere in your code.

 

#include "BtnEnh.h"

 

The TextDescriptor object is defined by the control wrapper class CTextDescriptor contained inside the TextDescriptor.cpp and TextDescriptor.h files: in order to access this object, you will have to insert the following line of code somewhere in your code.

 

#include "TextDescriptor.h"

 

Here follows the code needed to perform the requested operation of changing the Caption text and color.

// declare a TextDescriptor object

CTextDescriptor text;

 

// init the object with the control's caption TextDescriptor

text = MyButton.GetTextDescrCaption ();

 

// change settings

text.SetText (_T("My Caption"));

text.SetColorNormal (RGB (0, 0, 255));

 

As you can see the access to the TextDescriptor properties Text and ColorNormal are wrapped by the SetText and SetColorNormal functions declared inside the wrapper class CTextDescriptor.

 

Microsoft Visual Basic (5.0 and 6.0)

 

Here follows the code needed to perform the requested operation of changing the Caption text and color.

' change settings

MyButton.TextDescrCaption.text = "My caption"

MyButton.TextDescrCaption.ColorNormal = RGB(0, 0, 255)

 

 

Microsoft Visual Basic.NET (2003)

Here follows the code needed to perform the requested operation of changing the Caption text and color.

' change settings

MyButton.TextDescrCaption.Text = "My caption"

MyButton.TextDescrCaption.ColorNormal = Convert.ToUInt32(RGB(0, 0, 255))

 

Microsoft Visual C#.NET (2003)

Here follows the code needed to perform the requested operation of changing the Caption text and color.

// change settings

MyButton.TextDescrCaption.Text = "My caption";

MyButton.TextDescrCaption.ColorNormal = Convert.ToUInt32 (ColorTranslator.ToWin32 (Color.Blue));

 

Microsoft Visual J#.NET (2003)

Here follows the code needed to perform the requested operation of changing the Caption text and color.

// change settings

MyButton.get_TextDescrCaption ().set_Text ("My Caption");

System.UInt32 color = (System.UInt32) ColorTranslator.ToWin32 (Color.get_Blue ());

MyButton.get_TextDescrCaption ().set_ColorNormal (color);

As you can see in J#.NET the access to the button properties is made through the use of wrapper functions (automatically generated when you insert the control inside your project) with the "get_" and "set_" prefixes. Intellisense will help you finding the right wrapper function.