private Control GetEditControl(string labelText, bool lookingForGhostVersion) { DetailList detailList = ((DictionaryControl)_task.Control).Control_EntryDetailPanel.ControlEntryDetail; Control foundControl = null; for (int i = 0; i < detailList.RowCount; i++) { Label label = detailList.GetLabelControlFromRow(i); if (label.Text == labelText) { foundControl = detailList.GetEditControlFromRow(i); if (lookingForGhostVersion) { if (!foundControl.Name.Contains("ghost")) { foundControl = null; continue; } } break; } } return(foundControl); }
public void RowsInRightPlaceWithMinorMeaningLabel() { using (DetailList dl = MakeDetailList(false, true, MakeViewTemplate())) { Label l = dl.GetLabelControlFromRow(0); Assert.AreEqual("Word", l.Text); } }
private static DeleteButton GetDeletebutton(DetailList detailList, string labelText) { DeleteButton deleteButton = null; for (int i = 0; i < detailList.RowCount; i++) { Label label = detailList.GetLabelControlFromRow(i); if (label != null && label.Text == labelText) { deleteButton = detailList.GetDeleteButton(i); break; } } return(deleteButton); }
private static MultiTextControl GetEditControl(DetailList detailList, string labelText) { MultiTextControl editControl = null; for (int i = 0; i < detailList.RowCount; i++) { Label label = detailList.GetLabelControlFromRow(i); if (label != null && label.Text == labelText) { editControl = (MultiTextControl)detailList.GetEditControlFromRow(i); break; } } return(editControl); }
private void EnsureField_Change_UpdatesSenseMeaning(LexEntry entry) { using (EntryViewControl entryViewControl = CreateFilteredForm( entry, _primaryMeaningFieldName, "LexSense", WritingSystemsIdsForTests.AnalysisIdForTest )) { DetailList entryDetailControl = entryViewControl.ControlEntryDetail; Label labelControl = entryDetailControl.GetLabelControlFromRow(0); Assert.AreEqual("Meaning 1", labelControl.Text); MultiTextControl editControl = (MultiTextControl)entryDetailControl.GetEditControlFromRow(0); editControl.TextBoxes[0].Focus(); editControl.TextBoxes[0].Text = "test"; entryDetailControl.GetEditControlFromRow(2).Focus(); Assert.IsTrue(editControl.TextBoxes[0].Text.Contains(GetMeaning(entry))); } }
private string GetLabelOfMeaningRow(int whichMeaningZeroBased) { DetailList detailList = ((DictionaryControl)_task.Control).Control_EntryDetailPanel.ControlEntryDetail; int foundSoFar = -1; for (int i = 0; i < detailList.RowCount; i++) { Label label = detailList.GetLabelControlFromRow(i); if (label.Text.Contains("Meaning")) { ++foundSoFar; if (foundSoFar == whichMeaningZeroBased) { return(label.Text); } } } return("Not Found"); }
protected override void AddWidgetsAfterGhostTrigger(PalasoDataObject wsdo, Control refControl, bool doGoToNextField) { DetailList.SuspendLayout(); base.AddWidgetsAfterGhostTrigger(wsdo, refControl, doGoToNextField); // We need to update the label on the ghost slice, either adding a number to the end // or incrementing the number at the end. var position = DetailList.GetCellPosition(refControl); var label = DetailList.GetLabelControlFromRow(position.Row); Debug.Assert(label != null); Match match = Regex.Match(label.Text, @"(^.*) ([0-9]+)$"); int n; // Note that Regex Groups have 1-based indexing. if (match.Success && Int32.TryParse(match.Groups[2].Value, out n)) { label.Text = String.Format("{0} {1}", match.Groups[1].Value, n + 1); } else { label.Text = label.Text + @" 2"; } DetailList.ResumeLayout(); }
protected override void UpdateGhostLabel(int itemCount, int rowOfGhost) { DetailList.GetLabelControlFromRow(rowOfGhost).Text = GetLabelForMeaning(itemCount); }