• *****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.

     

     
  • 相关阅读:
    python之路day08--文件的操作
    python之路day07-集合set的增删查、列表如何排重(效率最高的方法)、深浅copy
    python之路day06-python2/3小区别,小数据池的概念,编码的进阶str转为bytes类型,编码和解码
    python之路day05--字典的增删改查,嵌套
    python之路day04--列表的增删改查,嵌套、元组的嵌套、range、for循环嵌套
    python之路day03--数据类型分析,转换,索引切片,str常用操作方法
    python之路day02--格式化输出、初始编码、运算符
    python之路day01--变量
    线程、进程、协程 异步io
    Ubuntu学习(转载)
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2109798.html
Copyright © 2020-2023  润新知