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.

     

     
  • 相关阅读:
    POJ 3659 Cell Phone Network(树的最小支配集)(贪心)
    2017 Hackatari Codeathon C. Arcade(DP)(滚动数组)
    2017 Hackatari Codeathon B. 2Trees(深搜)(想法)
    Codeforces Round #307 (Div. 2) E. GukiZ and GukiZiana(分块)
    Codeforces Round #407 (Div. 2) D. Weird journey(欧拉路)
    HDU 5669 Road(线段树建树)(分层图最短路)
    【bzoj2763】[JLOI2011]飞行路线 (分层图最短路)(优先队列dij)
    sed命令基本用法
    linux文本编辑器vim
    oracle row_number() over(partition by .. order by ..)和rank() over(partition by .. order by ..) 和dense_rank() over(partition by .. order by ..)的相似点与区别
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2109798.html
Copyright © 2011-2022 走看看