ocaf problem with selection

Hi.

I make a ocaf document and successly activate. But problems has come. I can't select the object. Of course, i added the TNaming_NamingShape using TNaming_Builder. below code is my procedure.

Handle(TDocStd_Document) D = GetOcafDoc();

D->NewCommand();
AS2D_Command TSC(D->Main());

CString CCount;
CCount.Format(_T("%d"), VertexCount);
CString CVertex = _T("Vertex") + CCount;

CT2CA tmpStr(CVertex);
string SVertex(tmpStr);

char* charVertex = new char;

strcpy_s(charVertex, strlen(charVertex), SVertex.c_str());
TCollection_AsciiString Name(charVertex);

// Create a new box using the CNewBoxDlg Dialog parameters as attributes
TDF_Label L=TSC.CreateVertex(P.X(), P.Y(), P.Z(), TCollection_ExtendedString(Name));

// Get the TPrsStd_AISPresentation of the new box TNaming_NamedShape
Handle(TPrsStd_AISPresentation) prs= TPrsStd_AISPresentation::Set(L, TNaming_NamedShape::GetID());
//Handle(TPrsStd_AISPresentation) prs= TPrsStd_AISPresentation::Set(L, AS2D_VertexDriver::GetID());

// Display it
prs->Display(1);

// Attach an integer attribute to L to memorize it's displayed
TDataStd_Integer::Set(L, 1);
myAISContext->UpdateCurrentViewer();

anyone help me??

shudolf's picture

sorry.. i do it.

i forgot to add MoveTo()..

have a nice day