I sometimes help out a friend who is writing a component set for use with DirectX, however with his lastig question he got me puzzled and I was hoping you guys could help me out...
He wants to make a property that is shown as combobox, with all the constants as items in the object inspector, which is pretty easy:
Type TSomething = (option1, option2, option3);
property Something : TSomething write FSomething read FSomething;
This is not the problem, but he wants to do this with the _D3DFormat type which can be found in the Direct3D8 library. When this type is used in a property it just plainly shows an "editbox" for integer values, here is the structure of the _D3DFormat type (shortened):
type
_D3DFORMAT = {$IFDEF TYPE_IDENTITY}type {$ENDIF}DWord;
{$ELSE}
type
_D3DFORMAT = (
D3DFMT_UNKNOWN = 0,
D3DFMT_R8G8B8 = 20,
D3DFMT_A8R8G8B8 = 21,
D3DFMT_X8R8G8B8 = 22,
D3DFMT_R5G6B5 = 23,
D3DFMT_INDEX32 =102,
...
D3DFMT_FORCE_DWORD = $7fffffff
);
{$ENDIF}
{$EXTERNALSYM _D3DFORMAT}
D3DFORMAT = _D3DFORMAT;
{$EXTERNALSYM D3DFORMAT}
PD3DFormat = ^TD3DFormat;
TD3DFormat = _D3DFORMAT;
How can I make the constant values appear in the object inspector in some sort of combobox... I looked up the TColor property and type and tried to make a copy of the _D3DFormat structure/type and edit it so it would work like the TColor type, but it did exactly the same as it does now, it shows an editbox for integral input!
Bookmarks