void CArrayGrid::OnLButtonDown(UINT nFlags, CPoint point)
{
	CBCGPGridCtrl::OnLButtonDown(nFlags, point);
	CDlgParamEditArray::DataType type = ((CDlgParamEditArray*)GetParent())->m_dataType;
	if (type!=CDlgParamEditArray::TypeBool)
		return;

	if (IsColumnSelected(0))
		return;

	CBCGPGridItem * pItem = GetCurSelItem();
	if (pItem==NULL)
		return;

	CString str;
	ConvertBSTR2CString( str, pItem->GetValue().bstrVal );
	if ( str.CompareNoCase("true") == 0 )
		str = "false";
	else
		str = "true";

	pItem->SetValue( (LPCTSTR)(str) );
	int iRow = pItem->GetGridItemID().m_nRow;
	((CDlgParamEditArray*)GetParent())->m_vArray[iRow] = str;
}
BOOL OperationParameterDialog::FillParameterGrid()
{
	if(NULL == userInputParameters)
		return FALSE;

	vector<OperationParameterPtr>::const_iterator curIterator = userInputParameters->begin();
	vector<OperationParameterPtr>::const_iterator endPos = userInputParameters->end();
	for(; curIterator != endPos; curIterator++)
	{
		OperationParameterPtr curParameterPtr = *curIterator;
		CBCGPGridRow* parameterRow = parameterInputCtrl.CreateRow(parameterInputCtrl.GetColumnCount());

		CBCGPGridItem* nameGridItem = parameterRow->GetItem(PARAMETER_NAME_COLUMN_INDEX);
		nameGridItem->SetValue((LPCSTR)curParameterPtr->GetDisplayName(), FALSE);
		nameGridItem->AllowEdit(FALSE);

		CBCGPGridItem* valueGridItem = parameterRow->GetItem(PARAMETER_VALUE_COLUMN_INDEX);
		valueGridItem->SetValue((LPCSTR)curParameterPtr->GetValue(), FALSE);

		CBCGPGridItem* rangeGridItem = parameterRow->GetItem(PARAMETER_RANGE_COLUMN_INDEX);
		rangeGridItem->SetValue((LPCSTR)curParameterPtr->GetValueRange(), FALSE);
		rangeGridItem->AllowEdit(FALSE);

		CBCGPGridItem* unitGridItem = parameterRow->GetItem(PARAMETER_UNIT_COLUNM_INDEX);
		unitGridItem->SetValue((LPCSTR)curParameterPtr->GetValueUnit(), FALSE);
		unitGridItem->AllowEdit(FALSE);

		parameterInputCtrl.AddRow(parameterRow, FALSE);

		parameterRow->SetData((DWORD_PTR)curParameterPtr.get());
	}

	parameterInputCtrl.AdjustLayout();

	return TRUE;
}