Add a Gauge at run time. Problems
Posted: Thu Nov 27, 2003 5:28 am
After creating a gauge at run time it is visble, but I cannot access it to do anything with it.
m_ChartGauge.Series(0).GetAsGauge().SetValue(50.0); // does not work
Here is the create() function of a formview where I also create the gauge.
BOOL C_ControlPanel::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
if ( ! CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext) )
{
return false;
}
if (!m_ChartGauge.Create(lpszClassName,
"",
dwStyle,
CRect(0,300,120,400),
this,
IDC_TCHART_GAUGE,
pContext ))
{
return FALSE;
}
m_ChartGauge.SetVisible(true); // OK the gauge iis visible
m_ChartGauge.AddSeries(scGauge); // is this needed ?
m_ChartGauge.Series(0).GetAsGauge().SetValue(50.0); // does not work
return TRUE;
}
m_ChartGauge.Series(0).GetAsGauge().SetValue(50.0); // does not work
Here is the create() function of a formview where I also create the gauge.
BOOL C_ControlPanel::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
if ( ! CFormView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext) )
{
return false;
}
if (!m_ChartGauge.Create(lpszClassName,
"",
dwStyle,
CRect(0,300,120,400),
this,
IDC_TCHART_GAUGE,
pContext ))
{
return FALSE;
}
m_ChartGauge.SetVisible(true); // OK the gauge iis visible
m_ChartGauge.AddSeries(scGauge); // is this needed ?
m_ChartGauge.Series(0).GetAsGauge().SetValue(50.0); // does not work
return TRUE;
}