Copyright © 1998-2023 MultiMedia Soft

How to use Mnemonic Constants

Previous pageReturn to chapter overviewNext page

The use of Mnemonic Constants inside your code adds more readability to your code. Starting from version 7, the control implements a new internal design to the control COM's interface to expose these public enumerated types. You will see them in the drop downs on property sheets and in Microsoft's Intellisense feature. The one environment where this is not the case is Microsoft Visual C++ environment (due to the manner in which the environment communicates with the control).

The following is the full list of enumerated types with their associated properties:

Enumerated type

Corresponding properties

enumStyles

Style

enumShapes

Shape

enumSurfaces

Surface

enumSpecEffects

SpecialEffect

enumFrameEffects

FrameEffect

enumPictTranspModes

PictureTranspMode

enumGrds

Slant, SpecialEffectFactor and FlatPillowFactor

enumOrientations

Orientation

enumSmooths

SmoothEdges

enumShadowModes

ShadowMode

enumTextEffects

TextDescriptor.SpecialEffect

enumGradientRender

SurfaceColor.Render3DType

enumGradientType

SurfaceColor.GradientType

enumTextureModes

Texture.Mode

enumCaptionAlignment

TextCaptionAlignment

enumFocusModes

FocusMode

enumPicturePositions

PicturePosition

enumPictures

SetAnimFromMemory, SetAnimFromNet, SetPictureFromHandle, SetPictureFromMemory and SetPictureFromNet methods

enumSounds

SetSoundFromMemory, SetSoundFromNet and SetSoundSync methods

enumTplBinaryTypes

SetTemplateBinDir method

enumHorzAlign

CellsManager.TextHorzAlign and CellsManager.PictureHorzAlign

enumVertAlign

CellsManager.TextVertAlign and CellsManager.PictureVertAlign

enumLightDirections

LightDirection

enumExportFormats

ExportBtnImage method

enumExportImages

ExportBtnImage and GetControlBitmap methods

enumSpotlightTypes

SpotlightType

enumScaleUnits

CellsManager.ScaleUnits

enumVistaLooks

VistaLook

enumVistaGlossyShapes

VistaGlossyShape

enumProgressBarTypes

ProgressBarType

enumProgressBarFillModes

ProgressBarFillMode

enumSplitButtonTypes

SplitButtonType

The following examples, under different development environments, show how to implement Mnemonic Constants in your code. These examples assume that one instance of the control, named MyButton, exists on a form or dialog box. The purpose of the code is to transform, at run-time, the shape of MyButton from Rectangular to Ellipse.

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

Microsoft Visual Basic 5 and 6

Microsoft Visual Basic.NET

Microsoft Visual C#.NET

Microsoft Visual J#.NET

 

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

 

Because of the different behavior of these environments, you need to include the module 3dabm8.h in order to use predefined Mnemonic Constants: This module can be found inside the Include directory (default C:\Program files\MultiMedia Soft\3D Active Button Magic\include).

 

Now change the button shape using the following line of code:

 

MyButton.SetShape (SHAPE_ELLIPSE);

 

The SetShape function is defined by 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 this function, you will have to insert the following line of code somewhere in your code.

 

#include "BtnEnh.h"

 

The mnemonic constant SHAPE_ELLIPSE can be found inside the 3dabm8f.h module file. So, in order to access this value, you will have to insert the following line of code somewhere in your code.

 

#include "3dabm8.h"

 

Microsoft Visual Basic 5 and 6

 

In this environment it is easy to use that Intellisense features that make it easy to assign the intended value to the Shape property.

After typing the code...

MyButton.Shape

press the '=' character on your keyboard. Intellisense displays the listbox of the possible values that can be assigned to the Shape property

3dabm_i000088

Select the SHAPE_ELLIPSE value to complete the line of code as follows:

MyButton.Shape = SHAPE_ELLIPSE

 

Microsoft Visual Basic.NET

 

In this environment it is also easy to use that Intellisense features that make it easy to assign the intended value to the Shape property.

After typing the code...

MyButton.Shape

press the '=' character on your keyboard. Intellisense displays the listbox of the possible values that can be assigned to the Shape property.

 

3dabm_i000089

 

Select the BTNENHLib4.enumShapes.SHAPE_ELLIPSE value so the complete line of code will be:

MyButton.Shape = BTNENHLib4.enumShapes.SHAPE_ELLIPSE

 

Microsoft Visual C#.NET

 

This environment requires a couple of additional lines of code to make use of Intellisense. First, the following code must be inserted at the beginning of the form management file:

using BTNENHLib4;

After having inserted the code

MyButton.Shape

To use Intellisense, you must add enumShapes after the equal sign in order to trigger the enumShapes enumerated type. After typing a period, Intellisense is activated.

MyButton.Shape = enumShapes

 

3dabm_i00008a

Select the enumShapes.SHAPE_ELLIPSE value so the complete line of code will be:

MyButton.Shape = enumShapes.SHAPE_ELLIPSE;

 

Microsoft Visual J#.NET

 

Intellisense can be used with J# as well, but with a few differences.  After typing...

MyButton

Intellisense displays the available wrapper functions.

3dabm_i00008b

The tooltip on the right of the listbox shows which enumerated type can be assigned to the property. Using the tooltip as a guide, you can make the appropriate selection.

MyButton.set_Shape (BTNENHLib4.enumShapes

press the dot '.' character and you will see the Intellisense display the listbox of the values declared inside the enumShapes enumerated type

3dabm_i00008c

select the SHAPE_ELLIPSE value so the complete line of code will be:

MyButton.set_Shape (BTNENHLib4.enumShapes.SHAPE_ELLIPSE);