zoukankan      html  css  js  c++  java
  • *****How to access a repositoryItemButtonEdit value from a FileDlg

    from:
    http://www.devexpress.com/Support/Center/p/Q205500.aspx

    I insert into my verticalGrid by programation a repositoryItemButtonEdit (as a row) that has of course a buttonEdit and a value, when the user click on the buttonEdit it make a fileDLG appears, I want to give back the path to the repositoryItemButtonEdit.OwnerValue and affect it to the tag's row.
    To do this work, I subscibe to the event repositoryItemButtonEdit.ButtonClick in the Method OnClick a wrote the instruction fileDlg.ShowDialog() but I dont know how to access to the base row from here.

    =================================

    Set the vGridControl.ActiveEditor.EditValue property to the FileDialog's FileName property value.

    =================================

    I've got a problem setting GridView cell value from RepositoryItemButtonEdit that shows my form as a dialog.
    I did it like in two Examples:

    [C#]
            private static void buttonEdit_ButtonClick(object sender, ButtonPressedEventArgs e)
            {
                using (OpenFileDialog dlg = new OpenFileDialog())
                {
                    dlg.Filter = "Файлы шаблонов(*.dot)|*.dot";
                    if (dlg.ShowDialog() == DialogResult.OK)
                        (sender as ButtonEdit).EditValue = new System.IO.FileInfo(dlg.FileName).FullName;
                }
            }

    [C#]
    private void buttonEdit1_ButtonPressed(object sender, ButtonPressedEventArgs e) {
        ButtonEdit editor = (ButtonEdit)sender;
        int buttonIndex = editor.Properties.Buttons.IndexOf(e.Button);
        if (buttonIndex == 0) {
          Form2 form = new Form2(editor.EditValue);
          if (form.ShowDialog(this) == DialogResult.OK)
            editor.EditValue = form.EditingValue;
        }
    }

    as for the first example I implemented it and it works and changes the cell value and text.
    And here is the problem: when I use my own form as a dialog editor.EditValue doesn't affect the cell value:

    [C#]
            private static void onButtonClick(object sender, ButtonPressedEventArgs e)
            {
                (sender as ButtonEdit).EditValue = "It still works";
                if (new myDialogForm().ShowDialog() == DialogResult.OK)
                            (sender as ButtonEdit).EditValue = "Now it affects nothing!!!";
                else
                    return;
                (sender as ButtonEdit).EditValue = "And here as well =(";
            }

    I partially solved the problem using:
    [C#]
            (((sender as ButtonEdit).Parent as GridControl).FocusedView as GridView).SetFocusedValue("Now it works");

    but I dont like it because it doesn't fire gridView's CellValueChanging event.

     

     
  • 相关阅读:
    找到一款不错的网站压力测试工具webbench
    nginx的Mainline version、Stable version、Legacy version的版本区别
    信号值大于-75dBm时
    爱快AP-H1使用方法及排错
    Windows 2008 Server搭建Radius服务器的方法
    碰到故障大全---cd
    win10系统中UserManager 总是被禁用怎么解决?
    win7共享文件夹设置无密码
    时钟.html
    微信开发者文档
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2109798.html
Copyright © 2011-2022 走看看