Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1500
Set a cell's display value without taking the focus
posted

Hi,

In our application there is the linking functionality that is very similar to Excel's. A cell may reference other cells (=A1 + B3) as well as other entities of the application, like nodes in the tree (=nodeA). We have the fx bar that is actually the same as Excel's.

The use case under discussion is this: when a user is entering a formula for a cell in the fx bar (again, like in Excel), the formula should be mirrored in the grid's cell as the user types it. Our grid (that is based on Infragistics grid) has the SetActiveCellText method that should do the trick. The implementation of the method is as follows (a little simplified for brevity):

public void SetActiveCellText(string text)

{

    ultraGrid.PerformAction(UltraGridAction.EnterEditMode);

    ultraGrid.ActiveCell.SelStart = 0;

    ultraGrid.ActiveCell.SelLength = text.Length;

    ultraGrid.ActiveCell.SelText = text;

}

That works fine except the grid takes the focus during entering edit mode tha actually sounds quite locally. 

That was the context for the problem and the question I have is: Is there a way to set grid's active cell selected text without the grid taking focus?

Thanks,

Vitaly

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Vitaly,

    You cannot access the selected text in the grid without having an ActiveCell. So the grid would have to have focus.

    But, you could set the Value of the cell without it having the focus - assuming that the DataType of the column allows strings.

    If that's no good, then another option might be to use a DrawFilter. The DrawFilter allows you to override the drawing in the cell so you can draw whatever you like.

Reply Children