Menu

#4 PopUp Editor (Cell with a button)

closed
nobody
None
1
2006-12-11
2006-12-11
No

In the code below you can see an example of an editor with a button on the right. You can use the button to open a dialog or execute a custom action.

In this example I use an OpenFileDialog as an editor:

class PopUpEditor : SourceGrid.Cells.Editors.TextBoxButton
{
public PopUpEditor():base(typeof(string))
{
Control.DialogOpen += new EventHandler(Control_DialogOpen);
}

void Control_DialogOpen(object sender, EventArgs e)
{
//TODO Open a dialog here
OpenFileDialog dg = new OpenFileDialog();
dg.ShowDialog(EditCellContext.Grid);

Control.Value = dg.FileName;
}
}

.....
You can use this editor with this code:
grid1[0, 0] = new SourceGrid.Cells.Cell("");
grid1[0, 0].Editor = new PopUpEditor();

Davide

Discussion

  • Davide Icardi

    Davide Icardi - 2006-12-11
    • status: open --> closed
     
  • Davide Icardi

    Davide Icardi - 2006-12-11
    • priority: 5 --> 1
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.