コード例 #1
0
ファイル: Mycug.cpp プロジェクト: whybe/Ultimate-Grid
void MyCug::OnHitBottom(long numrows,long rowspast,long rowsfound)
{
	if(rowsfound >0)
	{
		SetNumberRows(numrows+rowsfound,FALSE);
	}
}
コード例 #2
0
ファイル: DropDayCug.cpp プロジェクト: whybe/Ultimate-Grid
/////////////////////////////////////////////////////////////////////////////
//	SetDate
void CDropDayCug::SetDate( int nYear, int nMonth, int nDay )
{
	m_bIsUpdated = FALSE;
	SetNumberRows( 0 );
	m_appDate.SetDate( nYear, nMonth, nDay );

	if ( m_appDate.GetStatus() > 0 )
		// date is invalid or null
		return;

	// generate the SQL query
	CString sqlStr = "SELECT Completed, Appointment, Date FROM Appointments "
					 "WHERE Date = #" + m_appDate.Format() + "#;";
	m_adoDatasource.OpenSQL( sqlStr, "Driver={Microsoft Access Driver (*.mdb)};Dbq=Appointments.mdb;Uid=;Pwd=;" );

	// set added datasource to be default
	SetDefDataSource( m_adoDatasource.GetID());
	// complete the datasource binding operation, let grid adjust
	// itself to reflect information found in the datasource
	SetGridUsingDataSource( m_adoDatasource.GetID());

	SetSH_Width( 20 );
	SetColWidth( 0, 30 );
	SetColWidth( 1, 220 );
	SetColWidth( 2, 0 );

	AdjustComponentSizes();
}
コード例 #3
0
ファイル: Mycug.cpp プロジェクト: whybe/Ultimate-Grid
/////////////////////////////////////////////////////////////////////////////
//	OnDataSourceNotify
//		This message is sent from a data source , message
//		depends on the data source - check the information
//		on the data source(s) being used
//		- The ID of the Data source is also returned
void MyCug::OnDataSourceNotify(int ID,long msg,long param)
{
	if ( ID == UGDS_ID_DAO && msg == UGDSM_DAO_ADJUSTROWS )
	{
		SetNumberRows( param );
	}
}
コード例 #4
0
ファイル: Mycug.cpp プロジェクト: whybe/Ultimate-Grid
void MyCug::OnHitBottom(long numrows,long rowspast,long rowsfound)
{
	// used with datasources
	if ( rowsfound > 0 )
	{
		SetNumberRows( numrows + rowsfound, FALSE );
	}
}
コード例 #5
0
ファイル: DropDayCug.cpp プロジェクト: whybe/Ultimate-Grid
/////////////////////////////////////////////////////////////////////////////
//	OnHitBottom
//		This notification allows for dynamic row loading, it will be called
//		when the grid's drawing function has hit the last row.  It allows the grid
//		to ask the datasource/developer if there are additional rows to be displayed.
//	Params:
//		numrows		- known number of rows in the grid
//		rowspast	- number of extra rows that the grid is looking for in the datasource
//		rowsfound	- number of rows actually found, usually equal to rowspast or zero.
//	Return:
//		<none>
void CDropDayCug::OnHitBottom(long numrows,long rowspast,long rowsfound)
{
	UNREFERENCED_PARAMETER(rowspast);
	
	// used by the datasources
	if ( rowsfound > 0 )
	{
		SetNumberRows( numrows + rowsfound );
	}
}
コード例 #6
0
ファイル: MyCUG.cpp プロジェクト: whybe/Ultimate-Grid
/////////////////////////////////////////////////////////////////////////////
//	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" );
		}
	}
}
コード例 #7
0
void CLayerTypeGrid::OnSetup()
{
#ifdef CELL_EDIT
   DWORD dwStyle = 0;
   if ( m_myCUGEdit.GetSafeHwnd())
      m_myCUGEdit.DestroyWindow();

   dwStyle |= WS_CHILD|WS_VISIBLE;
   // create the edit control with specified style
   m_myCUGEdit.Create( dwStyle, CRect(0,0,0,0), this, 320001/*somerandom_ID*/ );
   m_myCUGEdit.SetAutoSize(TRUE);
   m_myCUGEdit.m_ctrl = this;
#endif

   SetNumberCols(0);
   SetNumberRows(0);

   BestFit(0, GetNumberCols()-1, myUG_FIT_ALL_ROWS, UG_BESTFIT_TOPHEADINGS);
   SetColWidth(-1, 0); // get rid of "row heading"
}
コード例 #8
0
ファイル: Mycug.cpp プロジェクト: whybe/Ultimate-Grid
/***************************************************
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" );
}
コード例 #9
0
ファイル: demo50g.cpp プロジェクト: whybe/Ultimate-Grid
/***************************************************
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);
}
コード例 #10
0
ファイル: Mycug.cpp プロジェクト: whybe/Ultimate-Grid
/***************************************************
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");
	}
}