void GridFrame::OnCellBeginDrag( wxGridEvent& ev ) { logBuf = wxEmptyString; logBuf << _T("Got request to drag cell at") << _T(" row ") << ev.GetRow() << _T(" col ") << ev.GetCol(); wxLogMessage( wxT("%s"), logBuf.c_str() ); ev.Skip(); }
void BreakpointsWnd::OnCellDClick(wxGridEvent& evt) { int r = evt.GetRow(); int c = evt.GetCol(); if (c != 0 && r <= gWorkspace->getBreakpointCount()) { auto b = gWorkspace->getBreakpoint(r); gFileEditorGroupWnd->gotoFile(b->file, b->line); } evt.Skip(); }
void GridFrame::OnCellValueChanged( wxGridEvent& ev ) { logBuf = wxEmptyString; logBuf << _T("Value changed for cell at") << _T(" row ") << ev.GetRow() << _T(" col ") << ev.GetCol(); wxLogMessage( wxT("%s"), logBuf.c_str() ); ev.Skip(); }
//------------------------------------------------------------------------------ void ForPanel::OnCellLeftClick(wxGridEvent& event) { Integer row = event.GetRow(); Integer col = event.GetCol(); conditionGrid->SelectBlock(row, col, row, col); conditionGrid->SetGridCursor(row, col); if (col == INDEX_SEL_COL || col == START_SEL_COL || col == INCR_SEL_COL || col == END_SEL_COL) GetNewValue(row, col + 1); }
void GridFrame::OnCellLeftClick( wxGridEvent& ev ) { logBuf = wxEmptyString; logBuf << _T("Left click at row ") << ev.GetRow() << _T(" col ") << ev.GetCol(); wxLogMessage( wxT("%s"), logBuf.c_str() ); // you must call event skip if you want default grid processing // (cell highlighting etc.) // ev.Skip(); }
void LMSImportChannelMapDialog::OnChannelMapGridCellLeftDClick(wxGridEvent& event) { if (event.GetCol() == 4) { wxColor c = ChannelMapGrid->GetCellBackgroundColour(event.GetRow(), 4); wxColourData data; data.SetColour(c); wxColourDialog dlg(this, &data); dlg.ShowModal(); ChannelMapGrid->SetCellBackgroundColour(event.GetRow(), 4, dlg.GetColourData().GetColour()); ChannelMapGrid->Refresh(); } }
void FDPPanel::OnInfluenceCellChanged(wxGridEvent& event) { wxGrid* pGrid = (wxGrid*)wxWindow::FindWindowById(ID_INFLUENCE_GRID, this); wxString data = pGrid->GetCellValue(event.GetRow(), event.GetCol()); wxString func = pGrid->GetCellValue(event.GetRow(), 0); double w; pGrid->GetCellValue(event.GetRow(), 1).ToDouble(&w); long fap; pGrid->GetCellValue(event.GetRow(), 2).ToLong(&fap); switch(event.GetCol()) { case 1: if(!data.ToDouble(&w)) { wxLogMessage(_T("Weight value should be a number! But it is %s"), data); pGrid->SetCellValue(event.GetRow(), event.GetCol(), _T("0")); w = 0; } break; case 2: if(data.ToLong(&fap)) { if(fap > 68 || fap < 1) { wxLogMessage(_T("FAP Id value should be a number between 1-68! But it is %s"), data); pGrid->SetCellValue(event.GetRow(), event.GetCol(), _T("0")); fap = 0; } } else { pGrid->SetCellValue(event.GetRow(), event.GetCol(), _T("0")); fap = 0; } break; } if( (func != wxEmptyString) && (fap > 0)/* && (w != 0)*/ ) Mediator::getInstance()->onModifyInfluence(event.GetRow(), (const char*)func.mb_str(), (float)w, (unsigned short)(fap-1)); }
void FindResultsWnd::OnGridCellDClick(wxGridEvent& event) { int r = event.GetRow(); int c = event.GetCol(); cz::UTF8String filefullpath = wxStringToUtf8(m_grid->GetCellValue(r, kFC_FileFullPath)); long line = 0; m_grid->GetCellValue(r, kFC_Line).ToLong(&line); long col = 0; m_grid->GetCellValue(r, kFC_Col).ToLong(&col); auto file = gWorkspace->createFile(filefullpath); if (file) gFileEditorGroupWnd->gotoFile(file, line, col); }
void udfFinalMarks::OnCellLClick( wxGridEvent& event ) { int row = event.GetRow(), col = event.GetCol(); wxString value = m_gridMarks->GetCellValue(row, col); if(value.IsEmpty()) m_gridMarks->SetCellValue(row, col, _("X")); else m_gridMarks->SetCellValue(row, col, _("")); event.Skip(); }
void MyFrame::on_cell_dclick(wxGridEvent& evt) { int col = evt.GetCol(); int row = evt.GetRow(); int id = evt.GetId(); for(auto const p : stepsGrids) { if(p.second != id) continue; if(wxTheClipboard->Open()) { wxTheClipboard->SetData(new wxTextDataObject(p.first->GetCellValue(row, col))); wxTheClipboard->Close(); } } }
void BreakpointsWnd::OnCellClick(wxGridEvent& evt) { int r = evt.GetRow(); int c = evt.GetCol(); if (c==0 && r<=gWorkspace->getBreakpointCount()) { gWorkspace->toggleBreakpoint(r); updateState(); } evt.Skip(); }
//---------------------------------------------------------------------------------------- void DBGrid::OnLabelRightDClick( wxGridEvent& ev ) { logBuf = _T("DBGrid::OnLabelRightDClick : "); if ( ev.GetRow() != -1 ) { logBuf << _T("row label ") << ev.GetRow(); } else if ( ev.GetCol() != -1 ) { logBuf << _T("col label ") << ev.GetCol(); } else { logBuf << _T("corner label"); } if ( ev.ShiftDown() ) logBuf << _T(" (shift down)"); // wxLogMessage( "%s", logBuf.c_str() ); logBuf += _T("\n"); wxLogMessage(logBuf.c_str()); ev.Skip(); }
virtual void OnGridEditorShown( wxGridEvent& event ) { int row, col; row = event.GetRow(); // 行? col = event.GetCol(); // 列? if (col==1) { const wxString& dir = wxDirSelector("Choose a folder"); if ( !dir.empty() ) { wxFileName f(dir); m_grid_dir->SetCellValue(row, col, dir); m_grid_dir->SetCellValue(row, 0, "Import." + f.GetName()); } } }
void MultiViewerMain::OnTableDBGridCellChange(wxGridEvent& event) { int nRow = event.GetRow(); int nCol = event.GetCol(); if(eGridAdding == m_eGridState && m_nEditRow <= nRow) { event.Skip(); return; } wxString wxStrCellValue = m_pTableDBDataGrid->GetCellValue(nRow, nCol); string szStrCellVale = SQLUtil::wxstr2str(wxStrCellValue); ModifyRow(nRow, nCol, szStrCellVale.c_str() ); }
void LabelDialog::OnCellChange(wxGridEvent &event) { static bool guard = false; int row = event.GetRow(); // Guard against recursion which can happen when a change to the "NEW label" row // is made. When InsertRow() is done in TransferDataToWindow(), checks are made // within wxGrid to see if the edit control is active and since it hasn't yet // been marked inactive on the first time through here, we get entered again. // Sort of a double change. I think this is probably a bug in wxGrid. if (guard) { return; } guard = true; // The change was to an existing label, so go process it based // on which column was changed. RowData *rd = &mData[row]; switch (event.GetCol()) { case Col_Track: OnChangeTrack(event, row, rd); break; case Col_Label: OnChangeLabel(event, row, rd); break; case Col_Stime: OnChangeStime(event, row, rd); break; case Col_Etime: OnChangeEtime(event, row, rd); break; case Col_Lfreq: OnChangeLfreq(event, row, rd); break; case Col_Hfreq: OnChangeHfreq(event, row, rd); break; } // Done...no need for protection anymore guard = false; return; }
//---------------------------------------------------------------------------------------- void DBGrid::OnCellChange( wxGridEvent& ev ) { logBuf = _T("DBGrid::OnCellChange : "); logBuf << _T("Cell at row ") << ev.GetRow() << _T(" col ") << ev.GetCol(); // wxLogMessage( "%s", logBuf.c_str() ); // wxMessageBox(logBuf); logBuf += _T("\n"); wxLogMessage(logBuf.c_str()); // you must call event skip if you want default grid processing // (cell highlighting etc.) // ev.Skip(); }
//--------------------------------------------------------- void CVIEW_Table_Control::On_RClick_Label(wxGridEvent &event) { wxMenu Menu; //----------------------------------------------------- if( event.GetCol() != -1 ) { Menu.SetTitle(wxString::Format(wxT("%s"), _TL("Columns"))); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_ADD); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_DEL); Menu.AppendSeparator(); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_COLS); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_SORT); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_RENAME); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_TYPE); PopupMenu(&Menu, event.GetPosition().x, event.GetPosition().y - GetColLabelSize()); } //----------------------------------------------------- else if( event.GetRow() != -1 ) { Menu.SetTitle(wxString::Format(wxT("%s"), _TL("Rows"))); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_ADD); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_INS); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_DEL); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_RECORD_DEL_ALL); Menu.AppendSeparator(); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_AUTOSIZE_ROWS); if( !FIXED_ROWS ) { Menu.AppendSeparator(); CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_SELECTION_TO_TOP); CMD_Menu_Add_Item(&Menu, true, ID_CMD_TABLE_SELECTION_ONLY); } PopupMenu(&Menu, event.GetPosition().x - GetRowLabelSize(), event.GetPosition().y); } //----------------------------------------------------- else { ClearSelection(); } }
void CRegisterView::OnMouseDownR(wxGridEvent& event) { // popup menu int row = event.GetRow(); int col = event.GetCol(); wxString strNewVal = GetValueByRowCol(row, col); TryParse("0x" + WxStrToStr(strNewVal), &m_selectedAddress); wxMenu menu; menu.Append(IDM_WATCHADDRESS, _("Add to &watch")); menu.Append(IDM_VIEWMEMORY, _("View &memory")); PopupMenu(&menu); }
void TableFrame::DisplayPopupMenu( wxGridEvent& ev ) { wxMenu* optMenu = wxXmlResource::Get()->LoadMenu("ID_TABLE_VIEW_MENU_CONTEXT"); TableInterface* ti = table_base->GetTableInt(); SetEncodingCheckmarks(optMenu, ti->GetFontEncoding()); popup_col = ev.GetCol(); // Set Group item vector<int> sel_cols; table_base->GetSelectedCols(sel_cols); bool any_sel_time_variant = false; for (int i=0; i<sel_cols.size(); i++) { if (ti->IsColTimeVariant(sel_cols[i])) { any_sel_time_variant = true; break; } } bool all_sel_compatible = false; if (!any_sel_time_variant && sel_cols.size() > 1) { // check for compatible types all_sel_compatible = true; for (int i=0; i<sel_cols.size(); ++i) { if (!ti->IsColNumeric(sel_cols[i])) { all_sel_compatible = false; break; } } } // Set Rename item wxString rename_str(_("Rename Variable")); if (popup_col != -1) { rename_str << " \"" << ti->GetColName(popup_col) << "\""; } optMenu->FindItem(XRCID("ID_TABLE_RENAME_VARIABLE"))->SetItemLabel(rename_str); bool enable_rename = false; if (popup_col!=-1) { if (ti->IsColTimeVariant(popup_col)) { enable_rename = true; } else { enable_rename = ti->PermitRenameSimpleCol(); } } optMenu->FindItem(XRCID("ID_TABLE_RENAME_VARIABLE"))->Enable(enable_rename); PopupMenu(optMenu, ev.GetPosition()); }
//--------------------------------------------------------- void CActive_Attributes_Control::On_RClick(wxGridEvent &event) { SetGridCursor(event.GetRow(), event.GetCol()); int iField = m_Field_Offset + event.GetCol(); CSG_Table_Record *pRecord = m_pTable->Get_Record(event.GetRow()); //----------------------------------------------------- if( m_pTable->Get_Field_Type(iField) == SG_DATATYPE_String ) { wxMenu Menu; CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_OPEN_APP); wxString Value = GetCellValue(event.GetRow(), event.GetCol()); if( _Get_DataSource(Value) ) { CMD_Menu_Add_Item(&Menu, false, ID_CMD_TABLE_FIELD_OPEN_DATA); } PopupMenu(&Menu, event.GetPosition()); } }
void ModelStateDialog::OnSingleNodeGridCellLeftDClick(wxGridEvent& event) { if (event.GetCol() == COLOUR_COL) { std::string name = NameChoice->GetString(NameChoice->GetSelection()).ToStdString(); wxColor c = SingleNodeGrid->GetCellBackgroundColour(event.GetRow(), COLOUR_COL); wxColourData data; data.SetColour(c); wxColourDialog dlg(this, &data); if (dlg.ShowModal() == wxID_OK) { SingleNodeGrid->SetCellBackgroundColour(event.GetRow(), COLOUR_COL, dlg.GetColourData().GetColour()); SingleNodeGrid->Refresh(); GetValue(SingleNodeGrid, event, stateData[name]); } } }
void GridFrame::OnLabelLeftClick( wxGridEvent& ev ) { logBuf = wxEmptyString; if ( ev.GetRow() != -1 ) { logBuf << _T("Left click on row label ") << ev.GetRow(); } else if ( ev.GetCol() != -1 ) { logBuf << _T("Left click on col label ") << ev.GetCol(); } else { logBuf << _T("Left click on corner label"); } if ( ev.ShiftDown() ) logBuf << _T(" (shift down)"); if ( ev.ControlDown() ) logBuf << _T(" (control down)"); wxLogMessage( wxT("%s"), logBuf.c_str() ); // you must call event skip if you want default grid processing // ev.Skip(); }
void GridFrame::OnSelectCell( wxGridEvent& ev ) { wxString logBuf; if ( ev.Selecting() ) logBuf << _T("Selected "); else logBuf << _T("Deselected "); logBuf << _T("cell at row ") << ev.GetRow() << _T(" col ") << ev.GetCol() << _T(" ( ControlDown: ")<< (ev.ControlDown() ? 'T':'F') << _T(", ShiftDown: ")<< (ev.ShiftDown() ? 'T':'F') << _T(", AltDown: ")<< (ev.AltDown() ? 'T':'F') << _T(", MetaDown: ")<< (ev.MetaDown() ? 'T':'F') << _T(" )"); //Indicate whether this column was moved if ( ((wxGrid *)ev.GetEventObject())->GetColPos( ev.GetCol() ) != ev.GetCol() ) logBuf << _T(" *** Column moved, current position: ") << ((wxGrid *)ev.GetEventObject())->GetColPos( ev.GetCol() ); wxLogMessage( wxT("%s"), logBuf.c_str() ); // you must call Skip() if you want the default processing // to occur in wxGrid ev.Skip(); }
void DataGrid::onCellChange(wxGridEvent &event) { long money = 0, moneyI = 0, moneyO = 0; int row = event.GetRow(); int col = event.GetCol(); struct item *it = dataPosFromRow(row); wxString text; if (m_data == NULL || row == 0) return; if (!(text = GetCellValue(row, IncomeIndex)).IsEmpty()) { moneyI = -str_to_money(text); } if (!(text = GetCellValue(row, OutlayIndex)).IsEmpty()) { moneyO = str_to_money(text); } if (moneyI != 0 && moneyO != 0) { wxMessageBox(HaStrings::errDupMoney, HaStrings::appName, wxOK | wxICON_ERROR); if (col == IncomeIndex) { money = moneyI; SetCellValue(row, OutlayIndex, wxT("")); } else if (col == OutlayIndex) { money = moneyO; SetCellValue(row, IncomeIndex, wxT("")); } } else if (moneyI != 0) { money = moneyI; SetCellValue(row, OutlayIndex, wxT("")); } else { money = moneyO; SetCellValue(row, IncomeIndex, wxT("")); } wxString desc = GetCellValue(row, DescIndex); desc.Trim(true).Trim(false); wxString comment = GetCellValue(row, CommentIndex); comment.Trim(true).Trim(false); struct string s_desc, s_comment; string_fill_slice(&s_desc, desc, '\0'); string_fill_slice(&s_comment, comment, '\0'); if (item_set(it, money, &s_desc, &s_comment) == NULL) throw std::bad_alloc(); m_data->setModified(); if (col == IncomeIndex || col == OutlayIndex) { updateBalanceAndTotal(); } if (is_dummy_item(it)) clearRow(row); wxCommandEvent ev(wxEVT_RESIZE_COL, GetId()); ev.SetEventObject(this); ev.SetInt(col); wxPostEvent(this, ev); }
void CEditLanguageDialog::OnRightClickOnGridLabel(wxGridEvent& event) { int nRow = event.GetRow(); int nCol = event.GetCol(); if (nCol == -1) { if (nRow == -1) { } else { wxMenu menu; menu.Append(0, _T("ChangeName")); menu.Append(1, _T("Delete")); int nRet = GetPopupMenuSelectionFromUser(menu, wxDefaultPosition); TString strOldLabel = m_pLanguageGrid->GetRowLabelValue(nRow); switch (nRet) { case 0: { TString strNewName = wxGetTextFromUser(_T("Input the new name please:"), wxGetTextFromUserPromptStr, strOldLabel); if (!strNewName.empty() && strOldLabel != strNewName) { bool bAddSuccess = ExamLanguageText(strNewName, true); if (bAddSuccess) { m_pLanguageGrid->SetRowLabelValue(nRow, strNewName); std::map<TString, std::map<ELanguageType, TString> >& languageMap = CLanguageManager::GetInstance()->GetLanguageMap(); languageMap[strNewName] = languageMap[strOldLabel]; languageMap.erase(strOldLabel); wxMessageBox(_T("更名成功")); } } } break; case 1: RemoveLanguageText(strOldLabel, nRow); break; case wxID_NONE: break; default: BEATS_ASSERT(false, _T("Never reach here!")); break; } } } }
void GridFrame::OnEditorShown( wxGridEvent& ev ) { if ( (ev.GetCol() == 4) && (ev.GetRow() == 0) && (wxMessageBox(_T("Are you sure you wish to edit this cell"), _T("Checking"),wxYES_NO) == wxNO ) ) { ev.Veto(); return; } wxLogMessage( wxT("Cell editor shown.") ); ev.Skip(); }
void ModelDialog::OngridStartChannelsCellChange(wxGridEvent& event) { int row = event.GetRow(), col = event.GetCol(); wxString tmpStr; long val; if (col==0) { tmpStr = gridStartChannels->GetCellValue(row,col); if ( (!tmpStr.ToLong(&val) || val <= 0) ) { wxMessageBox(_("Cell value must be a positive numeric value")); gridStartChannels->SetCellValue(row,col,wxT("1")); } } event.Skip(); }
void GLIDebugVariableGrid::OnCellDLeftClick(wxGridEvent &gridEvent) { //If the current row is expandable int currRow = gridEvent.GetRow(); int currColumn = gridEvent.GetCol(); //If double clicking on on a expandable row if(currColumn == NAME_COLUMN_INDEX) { if(ToggleRowExpansion(currRow)) { return; } } //Allow other windows to process the event gridEvent.Skip(); }
void FenetreHistogramme::NouvelHistogramme(wxGridEvent& event) { int l=event.GetRow(),c=event.GetCol(); ImageInfoCV *imAcq=NULL; if (!fenMere) return; int id=((FenetrePrincipale *)fenMere)->IdFenetre(); CameraVirtuelle *cam=((FenetrePrincipale *)fenMere)->Cam(); //wxCriticalSectionLocker enter(((FenetrePrincipale*)fenMere)->travailCam); if (((FenetrePrincipale *)fenMere)->ModeImage()!=1) imAcq =((FenetrePrincipale *)fenMere)->ImAcq(); double v; switch (l){ case 0 : if (imAcq && c>=0&& c<imAcq->channels()) event.GetString().ToLong((long*)&nbGraines[c]); break; case 1 : if (imAcq && c>=0&& c<imAcq->channels()&& excel) { event.GetString().ToDouble(&v); if( v<maxHisto[c]) minHisto[c]=v; else { excel->DefCellule(l,c,minHisto[c]); } } break; case 2 : if (imAcq && c>=0&& c<imAcq->channels()&& excel) { event.GetString().ToDouble(&v); if( v>minHisto[c]) maxHisto[c]=v; else excel->DefCellule(l,c,maxHisto[c]); } break; } Plot(1); }
void WeatherDlg::onColorCellLeftDClick( wxGridEvent& event ) { int col = event.GetCol(); int row = event.GetRow(); int val = atoi(m_ColorGrid->GetCellValue(row, col).mb_str(wxConvUTF8)); if( event.AltDown()) val--; else val++; if( val > 255 ) val = 255; if( val < 0 ) val = 0; m_ColorGrid->SetCellValue(row, col, wxString::Format(wxT("%d"), val)); evaluate(); m_RGBWPanel->setWeather(m_Props, event.GetRow(), m_ColorWhite->IsChecked(), m_ColorBrightness->IsChecked(), m_ColorSaturation->IsChecked(), m_ColorWhite2->IsChecked()); }