Exemplo n.º 1
0
BOOL CTWenUGCtrlEx::SetTitle(int nCol, CString cStrTitleName, int nColWidth, int nTitleNO)
{
	if(nCol>=GetNumberCols()) return FALSE;

	QuickSetText(nCol, nTitleNO, cStrTitleName);
	QuickSetFont(nCol, nTitleNO, m_nFontID_Title);
	SetColWidth(nCol, nColWidth);

	return TRUE;
}
Exemplo n.º 2
0
void CDDBaseGrid::SetMultiColHeading(int col1, int row1, int col2, int row2, CString headingStr)
{
   CUGCell cell;

   int res = JoinCells(col1, row1, col2, row2);
	GetCell(col1, row1, &cell);
   cell.SetCellTypeEx(UGCT_NORMALMULTILINE);
   SetCell(col1, row1, &cell);
   QuickSetText(col1, row1, headingStr);
}
Exemplo n.º 3
0
int CDDBaseGrid::QuickAddColumn(LPCTSTR columnTitle)
{
   // A convenient way to add a column and set column name.
   // Returns new column index.

   int colCnt = this->GetNumberCols();
   this->SetNumberCols(colCnt+1, FALSE);  // False turns off auto-redraw for added column.

   if (columnTitle != NULL && strlen(columnTitle) > 0)
      QuickSetText(colCnt, -1, columnTitle);

	return colCnt;  // Is now the index of added column
}
Exemplo n.º 4
0
/***************************************************
OnEditFinish
	This notification is sent when the edit is being finised
Params:
	col, row	- coordinates of the edit cell
	edit		- pointer to the edit control
	string		- actual string that user typed in
	cancelFlag	- indicates if the edit is being cancelled
Return:
	TRUE - to allow the edit it proceede
	FALSE - to force the user back to editing of that same cell
****************************************************/
int CDropDayCug::OnEditFinish(int col, long row,CWnd* edit,LPCTSTR string,BOOL cancelFlag)
{
	UNREFERENCED_PARAMETER(col);
	UNREFERENCED_PARAMETER(row);
	UNREFERENCED_PARAMETER(*edit);
	UNREFERENCED_PARAMETER(string);

	if ( cancelFlag == FALSE )
	{	// Every time appointment info is updated,
		// also update the date field
		QuickSetText( 2, row, m_appDate.Format());
	}

	return TRUE;
}
Exemplo n.º 5
0
/***************************************************
OnCellTypeNotify
	This notification is sent by the celltype and it is different from cell-type
	to celltype and even from notification to notification.  It is usually used to
	provide the developer with some feed back on the cell events and sometimes to
	ask the developer if given event is to be accepted or not
Params:
	ID			- celltype ID
	col, row	- co-ordinates cell that is processing the message
	msg			- message ID to identify current process
	param		- additional iformation or object that might be needed
Return:
	TRUE - to allow celltype event
	FALSE - to disallow the celltype event
****************************************************/
int CDropDayCug::OnCellTypeNotify(long ID,int col,long row,long msg,long param)
{
	UNREFERENCED_PARAMETER(col);
	UNREFERENCED_PARAMETER(param);

	if ( ID == UGCT_CHECKBOX && msg == UGCT_CHECKBOXSET )
	{
		// update the date field
		QuickSetText( 2, row, m_appDate.Format());
		// and redraw the appointment cell
		RedrawCell( 1, row );
	}

	return TRUE;
}
Exemplo n.º 6
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 MyCug::OnSetup()
{
	int cols = 4,
		rows = 5;

	SetDefColWidth( 60 );

	SetNumberRows( rows );
	SetNumberCols( cols );

	for ( int xIndex = 0; xIndex < cols; xIndex ++ )
	{
		for ( int yIndex = 0; yIndex < rows; yIndex ++ )
		{
			QuickSetText( xIndex, yIndex, "12345" );
		}
	}
}
Exemplo n.º 7
0
void CLayerTypeGrid::ExpandLayerGroup(int groupNameRowIndx)
{
   int rowCnt = GetNumberRows();
   int lastColIndx = GetNumberCols() - 1;

   bool keepGoing = true;
   for (int rowIndx = groupNameRowIndx+1; rowIndx < rowCnt && keepGoing; rowIndx++)
   {
      CString cellText( QuickGetText(lastColIndx, rowIndx) );
      int layerType = atoi(cellText);
      if (layerType < 0)
      {
         keepGoing = false;
      }
      else
      {
         SetRowHeight(rowIndx, m_expandedRowHeight);
      }
   }

   CString groupNameText( QuickGetText(0, groupNameRowIndx) );
   groupNameText.SetAt(0, '-');  // Is now expanded, show operator to collapse.
   QuickSetText(0, groupNameRowIndx, groupNameText);
}
Exemplo n.º 8
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);
}
Exemplo n.º 9
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 MyCug::OnSetup(){
	// setup rows and columns
	int rows = 30;
	int cols = 5;
	SetNumberRows(rows);
	SetNumberCols(cols);

	// initalize masked edit control, font, and border style
	m_pen.CreatePen (PS_SOLID,1,RGB(0,0,0));
	m_font.CreateFont (16,0,0,0,500,0,0,0,0,0,0,0,0,"Arial");
	SetDefFont (&m_font);

	// setup headings layout
	SetSH_Width (0);
	SetTH_NumberRows (2);
	SetTH_Height(40);
	SetTH_RowHeight(-1,20);
	SetTH_RowHeight(-2,20);
	JoinCells (0,-2,0,-1);
	JoinCells (2,-2,3,-2);
	JoinCells (4,-2,4,-1);
	// setup headings text
	QuickSetText (0,-2,"Date");
	QuickSetText (1,-2,"Number");
	QuickSetText (1,-1,"Type");
	QuickSetText (2,-2,"Payee");
	QuickSetText (2,-1,"Account");
	QuickSetText (3,-1,"Memo");
	QuickSetText (4,-2,"Deposit");
	EnableExcelBorders (FALSE);
	EnableCellOverLap (FALSE);

	// populate the first row group with data
	QuickSetText( 0, 0, "10/10/2001" );
	QuickSetText( 1, 0, "12203" );
	QuickSetText( 1, 1, "CHK" );
	QuickSetText( 2, 0, "Bell" );
	QuickSetText( 2, 1, "Phone" );
	QuickSetText( 4, 0, "45.50" );
}
Exemplo n.º 10
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 MyCug::OnSetup(){

	// initailize local vatiables
	int rows = 24;
	int cols = 14;
	int i,j;
	CString tmpNum;
	CUGCell cell;

	// setup rows and columns
	SetNumberRows(rows);
	SetNumberCols(cols);

	// fill-in cells with numbers
	// limit number of decimal places to 0
	GetCell (0,0,&cell);
	cell.SetNumberDecimals(0);
	cell.SetAlignment (UG_ALIGNRIGHT);
	for (i = 0; i < cols; i++)
		for (j = 0; j < rows; j++) {
			cell.SetNumber(rand()%1000);
			SetCell (i,j,&cell);
		}

	GetColDefault (10,&cell);
	m_pen.CreatePen (PS_SOLID,1,RGB(255,0,0));
	cell.SetBorderColor (&m_pen);
	cell.SetBorder (UG_BDR_LTHIN);
	SetColDefault (10,&cell);
	// create 3 column side heading
	SetSH_NumberCols(2);
	// ensure that side heading is large enough to fit 3 cols
	SetSH_Width(80);			
	SetSH_ColWidth(-1,30);		// resize columns in the side heading
	SetSH_ColWidth(-2,50);

	// create 3 row top heading
	SetTH_NumberRows(3);
	// ensure that top heading is large enough to fit 3 rows
	SetTH_Height(60);			
	SetTH_RowHeight(-1,20);		// resize rows in the top heading
	SetTH_RowHeight(-2,20);
	SetTH_RowHeight(-3,20);

	// join cells and assign text values in the top headings
	JoinCells (0,-3,9,-3);
	JoinCells (10,-3,13,-3);
	QuickSetText (0,-3,"Week-days");
	QuickSetTextColor (10,-3,RGB(255,0,10));
	QuickSetText (10,-3,"Week-end");
	for (i=0;i<cols;i+=2){
		JoinCells (i,-2,i+1,-2);
		if (i >= 10){
			QuickSetTextColor (i,-1,RGB(255,0,10));
			QuickSetTextColor (i+1,-1,RGB(255,0,10));
			QuickSetTextColor (i,-2,RGB(255,0,10));
		}
		QuickSetText (i,-1,"Sched.");
		QuickSetText (i+1,-1,"To Do");
	}
	QuickSetText (0,-2,"Monday");
	QuickSetText (2,-2,"Tuesday");
	QuickSetText (4,-2,"Wednesday");
	QuickSetText (6,-2,"Thursday");
	QuickSetText (8,-2,"Friday");
	QuickSetText (10,-2,"Satruday");
	QuickSetText (12,-2,"Sunday");

	// join cells and assign text in the side headings
	j = 8;
	for (i=0;i<rows;i+=2) {
		JoinCells (-2,i,-2,i+1);
		tmpNum.Format ("%d",j++);
		if (j < 13)
			tmpNum += " AM";
		else 
			tmpNum += " PM";
		QuickSetText (-2,i,tmpNum);
		QuickSetText (-1,i,":00");
		QuickSetText (-1,i+1,":30");
	}
}