|
> Developers
Guide
User Reference
2D Graph View
3D Topo Graph
View
FAQ - Developer¡¯s GuideQ. I want to
start using GraphWave controls without reading the Developer¡¯s Guide
first. What should I do? A. You should use MFC-generated wrapper
classes:
Dialog or FormView case: Step 1: Add the GraphWave ActiveX control to Dialog
(Form). To do this, right-click on the dialog editor window, and select
Insert ActiveX control.
Step 2: Select
Class Wizard/Member Variables/Add Variable on the inserted GraphWave
control¡¯s ID. Class Wizard will ask you to generate the MFC wrapper class
(es). Click OK. Bind the member variable.
Step
3: Use the member variable methods to manipulate the GraphWave
control.
Non-dialog case: Step
1: Create a dummy dialog and follow steps 1 to 3 for Dialog or Form
View cases. Step 5: Create wrapper objects
using the MFC-generated wrapper classes, and use the Create method to
create the GraphWave ActiveX object:
| m_ctrl.Create |
(NULL, WS_VISIBLE | WS_CHILD |
WS_TABSTOP, CRect(0,0,0,0), this, IDC_GRAPHWAVE1, NULL,
FALSE, L"{_LICENSE_KEY_}"); |
To use Data Objects used by GraphWave controls: Step 1: To generate the MFC Wrapper classes, open the
Class Wizard, select ¡®From type library...¡¯ under the Add Class button,
and import 3dgdata.dll and/or 2dgdata.dll. Step
2: Create a data object:
I3DGraphDataObject
DataObject; DataObject.CreateDispatch("3DGDataObject.DataObject");
Step 3: Manipulate the data
object: Further explanation on use of data objects is provided in
Developer¡¯s Guide.
Q. I have created a GraphWave control as a member
variable of a CView derived class. How do I handle control
events? A. You must add event sink maps manually. Add
¡°DECLARE_EVENTSINK_MAP¡± in the view¡¯s .h, and
¡°BEGIN_EVENTSINK_MAP/END_EVENTSINK_MAP¡± in .cpp, for example:
.h ¡¦ DECLARE_EVENTSINK_MAP() ¡¦ afx_msg void
OnClickGraphwave(); ¡¦ .cpp ¡¦ BEGIN_EVENTSINK_MAP(CMyView,
CView) //{{AFX_EVENTSINK_MAP(CMyView) ON_EVENT(CMyView, 155, -600
/* Click */, OnClickGraphwave,
VTS_NONE) //}}AFX_EVENTSINK_MAP END_EVENTSINK_MAP() ¡¦ void
CMyView::OnClickGraphwave() { AfxMessageBox("OnClick!"); } ¡¦
Q. But I can¡¯t find event ID¡¯s easily that way, is
there another way? A. There is a workaround. You can create a
dummy ActiveX GraphWave control in a dummy dialog, use the same control ID
for the GraphWave control for the required View, and map events
automatically through the ClassWizard. If that¡¯s not possible or
satisfactory, then map the required events through the ClassWizard and
copy/paste the ClassWizard generated code.
Q. I am using the composite GraphWave control that
allows for changes between modes. How can I acquire control to the
different GraphWave controls and their methods and
properties? A. Use the GetMode3D, GetMode2D, or
GetMode3DTopo methods.
Q. How do I
enumerate Data objects? A. Use the GetDataCount method to get
the Data objects count, and GetDataByIdx() to iterate.
MFC
sample: CString s; s.Format("Count: %d\n",
m_ctrl.GetDataCount()); for (int i=0; i<m_ctrl.GetDataCount();
i++) {
IUnknown * pData = m_ctrl.GetDataByIdx(i); if(pData !=
NULL) {
IDispatch *pDataDisp = NULL; HRESULT hr; hr =
pData->QueryInterface(IID_IDispatch,(void**)&pDataDisp); pData->Release();
I3DGraphDataObject
DataObject; DataObject.AttachDispatch(pDataDisp,FALSE); CString
s1; s1.Format("\n %d - '%s'", i,
DataObject.GetName()); s+=s1;
}
} AfxMessageBox(s);
Q. How do I enumerate markers, regions, labels, and
axes? A. Use GraphWave2D, GraphWave3D, and
GraphWave3DTopo GetCollection() method to obtain adequate collections.
Then use collection¡¯s CountMarkers (labels, regions) and other
methods to access data in a similar way to GetDataCount and
GetDataByIdx.
Q. How can I show or hide
GraphWave subwindows within the program? A. You set the
corresponding WindowsVisible property bits. For
example: m_Ctrl3d.SetWindowsVisible(m_ctrl.GetWindowsVisible() & ~
eToolBar & ~ eNavigator & ~ eInfoBar); Enum used in
WindowsEnable i WindowsVisible is: typedef enum tagWindows {
eNoWindows = 0x0000, eMenuButton = 0x0001, eToolBar =
0x0004, eTitleBar = 0x0008, eNavigator = 0x0010, eInfoView =
0x0020, eDataBrowser = 0x0040, eDataEditor = 0x0080, eEditField
= 0x0100, eInfoBar = 0x0200, eAllWindows = 0xFFFF
}EnumWindowComponents;
Q. My application uses built-in information
windows. How can I disable GraphWave controls in the Data Browser and Info
windows? A. Use SetWindowsEnable in the same way you use
SetWindowsVisible. It prevents disabled windows from being enabled by
users and the SetWindowsVisible command.
Q. SetWindowsEnable doesn¡¯t seem to work. I have
called SetWindowsEnable(0) but windows have stayed visible! A.
You must first use SetWindowVisible to hide or display windows. Then use
SetWindowsEnable to disable SetWindowVisible. Note: Using
SetWindowVisible after using SetWindowsEnable on disabled windows has no
effect!
Q. I want to capture keys pressed events before
they reach GraphWave ActiveX control, is that possible? A. Yes.
To make the necessary accelerators, go to the resource view, open the
Accelerator tree node, open the accelerator table, and add the required
accelerator entry. Use the ClassWizard on the accelerator¡¯s ID to generate
and map the response method.
TopÀ¸·Î
|