Exemple #1
0
int CRealTimeGrid::OnCellTypeNotify(long ID,int col,long row,long msg,long param)
{
	if( ID == m_buttonIndex && msg == UGCT_BUTTONCLICK )
	{
		QuickSetNumber( 0, row, 0 );
		QuickRedrawCell( 0, row );

		CUGCell cell;
		GetCell( 3, row, &cell );
		cell.SetBackColor(RGB(255,255,255));
		cell.SetTextColor(RGB(0,0,0));
		cell.SetText( _T( "Okay" ) );
		SetCell( 3, row, &cell );
		QuickRedrawCell( 3, row );

		TRACE( _T( "Reset the progress bar in row %ld" ), row );
		GotoCell( -1, row );
	}

	if( ID == UGCT_CHECKBOX && msg == UGCT_CHECKBOXSET )
	{
		if( param == TRUE )
			TRACE( _T( "Progress bar in row %ld was enabled." ), row );
		else
			TRACE( _T( "Progress bar in row %ld was disabled." ), row );
	}
		
	return TRUE;
}
void CLayerTypeGrid::OnDClicked(int col,long row, RECT *rect,POINT *point,BOOL processed)
{
   int lastColIndx = GetNumberCols() - 1;
   CString cellText(QuickGetText(lastColIndx, row));
   int layerType = atoi(cellText);

   // Edit color if a layerType row (not a group name row)
   // and double click was not in the layer type column.
   if (layerType > -1 && col > 0)
   {
      CUGCell cell;
      GetCell(col, row, &cell); 

      COLORREF color = cell.GetBackColor(); // current color

	   CPersistantColorDialog dialog(color);
	   if (dialog.DoModal() == IDOK)
      {
	      color = dialog.GetColor();
         cell.SetBackColor(color);
         SetCell(col, row, &cell);
         RedrawAll();
      }
   }
}
	/////////////////////////////////////////////////////////////////////////////
	//	OnSetup
	//		This function is called just after the grid window 
	//		is created or attached to a dialog item.
	//		It can be used to initially setup the grid
	void CNormalsDataGridCtrl::OnSetup()
	{

		m_font.CreateStockObject(DEFAULT_GUI_FONT);
		CreateBoldFont();
		m_cellBorderPen.CreatePen(PS_SOLID, 1, RGB(157, 157, 161));
		// create and set new top-heading class
		CExcelTopHdg* pExcelTopHdg = new CExcelTopHdg;
		pExcelTopHdg->Create(NULL, _T(""), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), this, 234752);
		SetNewTopHeadingClass(pExcelTopHdg);
		// create and set new side-heading class
		CExcelSideHdg* pExcelSideHdg = new CExcelSideHdg;
		pExcelSideHdg->Create(NULL, _T(""), WS_CHILD | WS_VISIBLE, CRect(0, 0, 0, 0), this, 234753);
		SetNewSideHeadingClass(pExcelSideHdg);
		m_CUGHint->SetFont(&m_font);
		m_CUGTab->ShowScrollbars(true);


		CUGCell cell;
		GetHeadingDefault(&cell);
		cell.SetAlignment(UG_ALIGNCENTER);
		cell.SetBorder(UG_BDR_RTHIN | UG_BDR_BTHIN);
		cell.SetBackColor(RGB(239, 237, 242));
		cell.SetHBackColor(RGB(162, 192, 248));
		cell.SetBorderColor(&m_cellBorderPen);
		cell.SetFont(&m_font);
		SetHeadingDefault(&cell);

		// create a font and set it as Grid Default
		GetGridDefault(&cell);
		cell.SetAlignment(UG_ALIGNCENTER);
		cell.SetFont(&m_font);
		cell.SetBorderColor(&m_cellBorderPen);
		cell.SetBorder(UG_BDR_RTHIN | UG_BDR_BTHIN);
		SetGridDefault(&cell);
		// create a font and set it as Heading Default

		// set default properties
		UseHints(TRUE);
		UseVScrollHints(TRUE);
		EnableMenu(TRUE);
		EnableExcelBorders(TRUE);


		SetDoubleBufferMode(TRUE);
		SetVScrollMode(UG_SCROLLNORMAL);//UG_SCROLLTRACKING
		SetHScrollMode(UG_SCROLLTRACKING);
		SetHighlightRow(FALSE, FALSE);
		SetMultiSelectMode(UG_MULTISELECT_CELL);//
		SetCurrentCellMode(3);



		SetTH_NumberRows(0);
		SetSH_NumberCols(0);
		SetNumberCols(0);
		SetNumberRows(0);


	}
void CNormalsEstimateCtrl::OnSetup()
{

    m_font.CreateStockObject(DEFAULT_GUI_FONT);
    CreateBoldFont();
    m_cellBorderPen.CreatePen(PS_SOLID, 1, RGB(157, 157, 161));


    m_CUGHint->SetFont(&m_font);
    m_CUGTab->ShowScrollbars(true);

    // add and set heading's default celltype
    CUGCell cell;
    GetHeadingDefault(&cell);
    cell.SetAlignment(UG_ALIGNCENTER);
    cell.SetBorder(UG_BDR_RTHIN | UG_BDR_BTHIN);
    cell.SetBackColor(RGB(239, 237, 242));
    cell.SetHBackColor(RGB(162, 192, 248));

    cell.SetBorderColor(&m_cellBorderPen);
    cell.SetFont(&m_font);
    SetHeadingDefault(&cell);

    // create a font and set it as Grid Default
    GetGridDefault(&cell);
    cell.SetAlignment(UG_ALIGNCENTER);
    cell.SetFont(&m_font);
    cell.SetBorderColor(&m_cellBorderPen);
    cell.SetBorder(UG_BDR_RTHIN | UG_BDR_BTHIN);
    SetGridDefault(&cell);
    // create a font and set it as Heading Default

    // set default properties
    UseHints(FALSE);
    UseVScrollHints(TRUE);

    EnableExcelBorders(TRUE);
    SetHighlightRow(UG_MULTISELECT_ROW, FALSE);
    SetMultiSelectMode(UG_MULTISELECT_OFF);
    SetCurrentCellMode(3);	//focus and highlighting
    SetDoubleBufferMode(TRUE);
    SetVScrollMode(UG_SCROLLTRACKING);
    SetHScrollMode(UG_SCROLLTRACKING);

    AddCellType(&m_sortArrow);


}
Exemple #5
0
/***************************************************
OnSetup
	This function is called just after the grid window 
	is created or attached to a dialog item.
	It can be used to initially setup the grid
****************************************************/
void CRealTimeGrid::OnSetup(){
	
	int y;
	int ROWS = 25;
	int COLS = 6;
	int iHeight;
	CUGCell cell;
	CString strTemp;
	CDC* pDC;

	m_pro1Index = AddCellType( &m_pro1 );
	m_pro1.SetCanAdjust( FALSE );
	m_buttonIndex = AddCellType( &m_button );

	pDC = GetDC();
	iHeight = -MulDiv( 10, GetDeviceCaps( pDC->m_hDC, LOGPIXELSY), 72 );
	m_font1.CreateFont( iHeight,0,0,0,800,0,0,0,0,0,0,0,0, _T( "Arial" ) );
	m_font2.CreateFont( iHeight,0,0,0,500,0,0,0,0,0,0,0,0, _T( "Arial" ) );
	ReleaseDC( pDC );
	
	SetDefFont(&m_font2);

	SetUniformRowHeight(TRUE);
	SetDefRowHeight(25);
	SetNumberCols(COLS);
	SetNumberRows(ROWS);
	SetDoubleBufferMode(1);
	Set3DHeight( 2 );

	SetTH_Height( 0 );
	SetSH_Width( 100 );

	for( y = 0 ; y < ROWS ; y++ )
	{
		QuickSetCellType(0,y,m_pro1Index);
		QuickSetAlignment(0,y,UG_ALIGNCENTER|UG_ALIGNVCENTER);
		QuickSetText( 0, y, _T( "20" ) );
		QuickSetTextColor(0,y,RGB(0,0,0));
		QuickSetHTextColor(0,y,RGB(0,0,0));
		JoinCells(0,y,2,y);

		QuickSetAlignment(3,y,UG_ALIGNCENTER|UG_ALIGNVCENTER);
		QuickSetText(3,y,_T( "Normal" ) );
		//QuickSetFont(3,y,&m_font2);

		strTemp.Format( _T( "Sensor %d" ), y );
		QuickSetText( -1, y, strTemp );
	}

	GetColDefault( 4, &cell );
	cell.SetCellType( m_buttonIndex );
	cell.SetText( _T( "Reset" ) );
	cell.SetAlignment( UG_ALIGNCENTER | UG_ALIGNVCENTER );
	cell.SetBackColor( GetSysColor( COLOR_BTNFACE ) );
	SetColDefault( 4, &cell );

	GetColDefault( 5, &cell );
	cell.SetCellType( UGCT_CHECKBOX );
	cell.SetLabelText( _T( "Enabled" ) );
	cell.SetBool( TRUE );
	cell.SetAlignment( UG_ALIGNVCENTER );
	SetColDefault( 5, &cell );
	SetColWidth( 5, GetColWidth( 5 ) + 20 );

	SetTimer( TIMERID, 100, NULL);
}