Methods and Classes of Custom Controls
 
 
 

For each control, there are two functions that you'll always use:

1. A function to initialize the pointer to the control so you may call its methods (usually when the dialog is initialized).

2. A function to release the control when you are done with it (when the dialog is destroyed).

The sample code below demonstrates this for a spinner control (the other controls are similar):

First, declare a pointer to the control:

static  ISpinnerControl *radSpin;

To initialize the pointer call:

radSpin=GetISpinner(GetDlgItem(hDlg,IDC_RAD_SPIN));

Each custom control has a Get function to return a handle to the control.

In the example above, two functions are called from a single statement. The GetDlgItem function retrieves the handle of a control in the specified dialog box. The parameter hDlg is the dialog handle. The IDC_RAD_SPIN parameter is the ID for the control. This is the name entered in the ID field of the Custom Control Properties dialog box when the control was created.

When you are finished using the control, call:

ReleaseISpinner(radSpin);

Each control has a Release function to release it.

See ICustomControl for a list of the methods that are available for all the custom controls.

The following functions are not a part of class ICustomControl but may also be used in conjunction with the custom controls and UI design in 3ds Max:

This is a bitmap brush where the bitmap is a gray and white checker board.

HBRUSH GetLTGrayBrush();
HBRUSH GetDKGrayBrush();

This returns the standard font.

HFONT GetFixedFont();

This returns the handle of the hand cursor used for panning.

HCURSOR GetPanCursor();

The following section provides links to the custom control classes that document how to use the specific methods of each control.

How to use the See
Custom Edit Control ICustEdit
Spinner Control ISpinnerControl
Custom Image Control ICustImage
Custom Status Control ICustStatus
Color Swatch Control

IColorSwatch

Custom Button Control ICustButton
Custom Toolbar Control ICustToolbar
Rollup Window Control IRollupWindow
Off Screen Buffer Control IOffScreenBuf
TCB Graph Control TCBGraphParams
Thumb Tack Control

This control installs a thumb tack into a window title bar which allows the user to make the window 'Always On Top'. There are two global functions for managing this control:

InstallThumbTack() - This function installs a thumb tack in the title bar of a window. NOTE: The window class for the window should have 4 extra bytes in the window structure for SetWindowLong().

RemoveThumbTack() - This function is used to remove the thumb tack from the window title bar.