fixed use of Insert Symbol into a table cell and fixed bug where you could not select /copy a portion of table cell text
This commit is contained in:
		@@ -947,26 +947,35 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
		/// <param name="selectAll">If false cursor will be placed at the begining</param>
 | 
							/// <param name="selectAll">If false cursor will be placed at the begining</param>
 | 
				
			||||||
		private void StartGridEditing(SelectionOption selOpt)
 | 
							private void StartGridEditing(SelectionOption selOpt)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (MyFlexGrid != null && MyFlexGrid.Editor == null)
 | 
								// Bug fix:  B2012-203, B2012-204
 | 
				
			||||||
 | 
								// Need to check if the selected table cell is in edit mode already.
 | 
				
			||||||
 | 
								// if already in edit mode, we don't want to do the StartEditing code below, because it
 | 
				
			||||||
 | 
								// will override the current cursor positioning and selection range.
 | 
				
			||||||
 | 
								Control ctrl = FindActiveControl();
 | 
				
			||||||
 | 
								if (ctrl is VlnFlexGrid) 
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				MyFlexGrid.StartEditing();
 | 
									// Selected table cell is not in edit mode. Go into edit mode and position acording
 | 
				
			||||||
				switch (selOpt)
 | 
									// to the pass in selOpt.
 | 
				
			||||||
 | 
									if (MyFlexGrid != null && MyFlexGrid.Editor == null)
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					case SelectionOption.Start:
 | 
										MyFlexGrid.StartEditing();
 | 
				
			||||||
						MyStepRTB.Select(0, 0);
 | 
										switch (selOpt)
 | 
				
			||||||
						break;
 | 
										{
 | 
				
			||||||
					case SelectionOption.All:
 | 
											case SelectionOption.Start:
 | 
				
			||||||
						MyStepRTB.SelectAll();
 | 
												MyStepRTB.Select(0, 0);
 | 
				
			||||||
						break;
 | 
												break;
 | 
				
			||||||
					case SelectionOption.End:
 | 
											case SelectionOption.All:
 | 
				
			||||||
						break;
 | 
												MyStepRTB.SelectAll();
 | 
				
			||||||
						MyStepRTB.Select(MyStepRTB.TextLength, 0);
 | 
												break;
 | 
				
			||||||
					default:
 | 
											case SelectionOption.End:
 | 
				
			||||||
						MyStepRTB.Select(0, 0);
 | 
												break;
 | 
				
			||||||
						break;
 | 
												MyStepRTB.Select(MyStepRTB.TextLength, 0);
 | 
				
			||||||
 | 
											default:
 | 
				
			||||||
 | 
												MyStepRTB.Select(0, 0);
 | 
				
			||||||
 | 
												break;
 | 
				
			||||||
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
					
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		public void btnInsPgBrk_Click(object sender, EventArgs e)
 | 
							public void btnInsPgBrk_Click(object sender, EventArgs e)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@@ -1050,18 +1059,25 @@ namespace Volian.Controls.Library
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
		private Control FindActiveControl()
 | 
							private Control FindActiveControl()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
								// added the flag below because a table (grid) could have a cell selected (a control)
 | 
				
			||||||
 | 
								// but it might not have focus (in edit mode)
 | 
				
			||||||
 | 
								bool beenThereDoneThat = false; // flag to prevent infinate loop
 | 
				
			||||||
			Control tmp = this;
 | 
								Control tmp = this;
 | 
				
			||||||
			while (!(tmp.Parent is Form))
 | 
								while (!(tmp.Parent is Form))
 | 
				
			||||||
				tmp = tmp.Parent;
 | 
									tmp = tmp.Parent;
 | 
				
			||||||
			Form frm = tmp.Parent as Form;
 | 
								Form frm = tmp.Parent as Form;
 | 
				
			||||||
			tmp = frm.ActiveControl;
 | 
								tmp = frm.ActiveControl;
 | 
				
			||||||
			while (tmp.Controls.Count > 0)
 | 
								while (!beenThereDoneThat && tmp.Controls.Count > 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									beenThereDoneThat = true;
 | 
				
			||||||
				foreach (Control ctrl in tmp.Controls)
 | 
									foreach (Control ctrl in tmp.Controls)
 | 
				
			||||||
					if (ctrl.ContainsFocus)
 | 
										if (ctrl.ContainsFocus)
 | 
				
			||||||
					{
 | 
										{
 | 
				
			||||||
						tmp = ctrl;
 | 
											tmp = ctrl;
 | 
				
			||||||
 | 
											beenThereDoneThat = false;
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			return tmp;
 | 
								return tmp;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		private void btnCut_Click(object sender, EventArgs e)
 | 
							private void btnCut_Click(object sender, EventArgs e)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user