/*************************************************** OnLClicked - overloaded CUGCellType::OnLClicked Checks to see if the slider has been clicked on. If the mouse button is pressed over the slider, then the slider is put into a interactive update state. Once the mouse button is release the interactive update state is turned off **See CUGCellType::OnLClicked for more details about this function ****************************************************/ BOOL CUGSliderType::OnLClicked(int col,long row,int updn,RECT *rect,POINT *point){ if(updn) { m_updateSlider = FALSE; } CUGCell cell; m_ctrl->GetCell(col,row,&cell); //get the slider percentage int percent = 0; if(cell.IsPropertySet(UGCELL_STRING_SET)) percent = _ttol(cell.GetText()); //get the percent if(percent >100) percent = 100; else if(percent <0) percent = 0; //find the slider x position long width = rect->right - rect->left - 6; int xPos = rect->left + 3 + ((width * percent) / 100); int mouseX = point->x; if(mouseX > xPos- 6 && mouseX < xPos+6) { m_updateSlider = TRUE; return TRUE; } return FALSE; }
void CNormalsDataGridCtrl::OnSetCell(int col, long row, CUGCell *cell) { ASSERT(col >= 0 && row >= -1); ASSERT(m_bEditable); if (row != -1 && col != -1) { size_t v = F2V(col); if (m_variables.none() || m_variables[v]) { CUGCell oldCell; GetCellIndirect(col, row, &oldCell); CTRef TRef = GetTRef(row); ASSERT(TRef.GetTM().Type() == CTM::HOURLY); std::string oldStr = CStringA(oldCell.GetText()); std::string newStr = CStringA(cell->GetText()); if (newStr != oldStr) { size_t pos = row*GetNumberCols() + row; m_bDataEdited[row].set(col); float newValue = UtilWin::ToFloat(cell->GetText()); m_bModified = true; (*m_pStation)[row][col] = newValue; } } } CUGEditCtrl::OnSetCell(col, row, cell); }
void CLayerTypeGrid::OnLClicked(int col,long row, int updn, RECT *rect, POINT *point, int processed) { // A click will get two event calls here, one for button down (updn = true) and one // for button up. We don't want to do this twice for a single click. // So react only to the button up, that is the end of the click event. if (updn) return; // Ignore the button down. int lastColIndx = GetNumberCols() - 1; CString cellText(QuickGetText(lastColIndx, row)); int layerType = atoi(cellText); // Toggle expand/collapse if layer type indicates this is a layer group row. // React only if cell was first column cell. if (layerType < 0 && col == 0) { int rowCnt = GetNumberRows(); CUGCell cell; GetCell(col, row, &cell); // We use the "+" and "-" in name to track expanded/collapsed state. // The char shows the current state. CString groupNameText( cell.GetText() ); bool isExpanded = (groupNameText.Left(1).Compare("-") == 0); if (isExpanded) { // Is expanded, perform collapse. CollapseLayerGroup(row); RedrawAll(); } else { // Is collapsed, perform expand. ExpandLayerGroup(row); RedrawAll(); } } }