60000107 DisplayFrames and PropertyGrid sample (VC++ 6.0)

Article 60000107
Type HowTo
Product Engine
Version 6
Date Added 4/5/2007
Fixed (4/5/2007)
Submitted by Patty Snow

Summary

Please send values for parameter to SetDisplayFrames of VectorDraw Wrapper (vdraw.ocx).Aalso it appears if you set DisplayFrames to ShowAll you get a embeded CVdGrid control - how do I access that (send code example to fill it with either figure properties or general properties please).

Solution

The vdrawcontrol has exported the following methods for grid manage:

  • SetGrid_SelectedObject , GetGrid_SelectedObject
  • SetGrid_Font ,GetGrid_Font select a new TTF font for the grid example: SetGrid_Font("Tahoma");
  • Grid_Refresh() // refresh the grid control
  • Grid_Clear() // clears the selected object of grid

Also the DiplayFrame gets the following on or more following values :
 - Default = 1 + 2 + 4 + 32,
 - HideAll = 0,
 - ShowAll = 1 + 2 + 4 + 8 + 16 + 32,
 - ShowStatusBar = 1,
 - ShowHorizontalScroll = 2,
 - ShowVerticalScroll = 4,
 - ShowPropertyGrid = 8,
 - ShowCommandLine = 16,
 - ShowLayoutTab = 32,

You can add the vdraw.ocx in a form and 3 buttons and write code like :

void CVdTest1Dlg::OnDocprop() //
{
	// Select the document object in the property grid
	m_vd.SetGrid_SelectedObject(m_vd.GetActiveDocument());
}

void CVdTest1Dlg::OnFigprops() 
{
	// Create a line and select the line in property grid
	m_vd.GetActiveDocument().New();
	double p1[3] = {1,1,0};
	double p2[3] = {2,2,0};
	COleSafeArray vp1;
	COleSafeArray vp2;
	vp1.CreateOneDim(VT_R8,3,&p1);
	vp2.CreateOneDim(VT_R8,3,&p2);
	CvdLine line = m_vd.GetActiveDocument().GetEntities().AddLine(vp1,vp2);
	line.Invalidate();
	m_vd.SetGrid_SelectedObject(line);
}

void CVdTest1Dlg::OnSelctionprops() 
{
	// Create a circle and a selection set with all objects in the entities collection and select the selection in the property grid
	m_vd.GetActiveDocument().New();
	double p1[3] = {1,1,0};
	COleSafeArray vp1;
	vp1.CreateOneDim(VT_R8,3,&p1);
	
	CvdCircle circle = m_vd.GetActiveDocument().GetEntities().AddCircle(vp1,1.0);
	circle.Invalidate();
	CvdSelection set = m_vd.GetActiveDocument().GetSelections().Add("TEST");
	set.Select(COleVariant("All"),COleVariant(),COleVariant());
	m_vd.SetGrid_SelectedObject(set);
}

Send comments on this topic.