Главная страница | назад





Article #19292: AnsiString Property editors

 Question and Answer Database

FAQ4292C.txt   :AnsiString Property editors
Category   :VCL
Platform    :Win95/NT
Product    :C++Builder1.0,   C++Builder3.x,   C++Builder4.x,   

Question:
How do I register AnsiString Property editors? 
The compiler seems to have problems registering the editor
with any AnsiString field I try.

Answer:
Due to AnsiString not being a VCL derived class the _
_classid(AnsiString) call in the first parameter to 
RegisterComponentEditor() will not compile. The solution
is to give the RegisterComponentEditor() what it wants, the
following function does this:


PTypeInfo AnsiStringTypeInfo(void)
{
    PTypeInfo typeInfo = new TTypeInfo;

    typeInfo->Name = "AnsiString";
    typeInfo->Kind =  tkLString;

    return typeInfo;
}

Use this function in place of __classid(AnsiString): ie:

RegisterPropertyEditor(AnsiStringTypeInfo(), __classid(TComponent), "FileName", __classid(TMPFilenameProperty));

1/21/1999 2:54:32 PM
 

Last Modified: 01-SEP-99