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
290
EditorButton simulate button click
posted

Hi,

I have an EditorButton that is an editor for a column in the grid. When user clicks on its right button I perform an action that requires current cell coordinates. This works as needed.
Here is the code.

void IGBdfDetailsPopupEdit::ButtonEditClick(System::Object ^sender, Infragistics::Win::UltraWinEditors::EditorButtonEventArgs ^e)
{
UltraTextEditor ^btn = (UltraTextEditor^)sender;
UltraGridCell ^cell = (UltraGridCell^)e->Context;
CellUIElement ^element = (CellUIElement^)cell->GetUIElement();
currentRectangle = grid->NativeGrid()->RectangleToScreen(element->Rect);
grid->CallPopup(this); // private method
}

Now I need to have the same behavior when user presses F4 in the text editor. I cannot extract this method and reuse as I don't have a reference to the Context in that new method.

How would I simulate a click on the EditorButton/RightButton element. It doesn't have the PerformClick as the normal button has.

Thx

 

Parents
  • 23930
    Offline posted

    Hi Mitja,

     

    Thank you posting in our forums.

     

    If I understand your question correctly, it seems that you need to call the click method in order to get the cell (the Context) in which the TextEditor is used. If that is the case, then calling the click method is not necessary. You can get the currently active cell, by using the grid’s ActiveCell property. You can substitute the Context with this property and extract the method. The ActiveCell property will return the currently active cell or null if there isn’t such cell. You can check if the cell is in edit mode from its IsInEditMode property.

     

    Please let me know if you have any additional questions.

Reply Children