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; }
int CDDBaseGrid::QuickSetTextAndColor(int col, long row, LPCTSTR string, COLORREF color) { // A convenient consolidation of QuickSetText and QuickSetColor, in order to // reduce the overall GetCell/SetCell calls, but also to reduce the number // of grid func calls in the application. ///m_cell.ClearAll(); CUGCell cell; GetCell(col, row, &cell); cell.SetText(string); cell.SetTextColor(color); SetCell(col, row, &cell); return UG_SUCCESS; }
/*************************************************** 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); }
// load the columns of this row into the memory manager long CUG_HTML_DataSource::LoadColumns(char* buff, char* buffEnd) { int col =0; CUGCell cell; char* begin = FindDetailStart(buff); char* next; char* end; char* tbegin; tbegin = FindTableStart(buff); if(tbegin > buffEnd) tbegin=NULL; // iterate until there are no more table // details of we are past the row end while(begin && begin<buffEnd) { // skip the rest of the tabe begin tag begin = strstr(begin, ">"); ASSERT(begin); begin++; // find the end of the detail end=FindDetailEnd(begin); // is there an embedded table? if(tbegin && begin <= tbegin && tbegin < end) { // find the end of the embedded table int level=0; end=FindTableEnd(begin); next=tbegin+1; while((next=FindTableStart(next))!=NULL && next<end) { next++; level++; } while(level-->0) { end++; end=FindTableEnd(end); } ASSERT(end); if(OnEmbeddedTableFound(col, m_rows, begin, end)==UG_NA) { cell.SetText(_T("Embedded Table")); SetCell(col, m_rows, &cell); } } else { // set the current cell. CString details(begin, end-begin); InterpretTags(details,&cell); SetCell(col, m_rows, &cell); } // goto the next detail section begin = FindDetailStart(end); col++; } m_cols=max(col,m_cols); return end-buff; }