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
907
How do you access a cells changed value when in edit mode?
posted

I'm bound to the CellValueCHanged event and it triggers, but while the value has changed visually, it hasn't changed in the cell.  I've tried a wide range of things and I can't find the changed value any where.  Does anyone have a sample program with working editors in winTree?  Snippets of code of what I have been trying...

 

Here is the construct wherre I try to use the changed event on the actual check editor.  That didn't work.

        public FieldListControl() {
            InitializeComponent();
            //
            // Set some default behaviors for the numeric editor we'll use in our cells.
            //
            ultraNumericEditor.NumericType              = NumericType.Integer;
            ultraNumericEditor.PromptChar               = ' ';
            ultraNumericEditor.SpinButtonDisplayStyle   = ButtonDisplayStyle.OnMouseEnter;
            //
            // Set some default behaviors for the check box editor we'll use in our cells.
            //
            ultraCheckEditor.CheckAlign = ContentAlignment.MiddleCenter;
            ultraCheckEditor.Text       = "";
            ultraCheckEditor.CheckedChanged += new EventHandler(ultraCheckEditor_CheckedChanged);
        }

        void ultraCheckEditor_CheckedChanged(object sender, EventArgs e) {
            int foo = 0;
        }

Here is the code where I deal with the cell editor change event, it triggers perfectly.  I wrote a seperate method to help investigate various possible location of my changed value.  All values are alays false, even though I have a checkbox with a check in it...

        private void ultraTreeFields_CellValueChanged(object sender, CellValueChangedEventArgs e) {
            if (loading == true) return;

            switch (e.Cell.Key) {
                case "Override Required":
                    //
                    // Make sure we have the expected objects.
                    //
                    if (e.Cell == null || e.Cell.Node == null) return;

                    FieldOverride overrideField = GetFieldOverride(e.Cell.Node);

                    if (overrideField == null) return;
                    //
                    // Set the field
                    //
                    overrideField.Required = IsNodeOverrideRequired(e.Cell.Node);
                    //
                    // Update all of the overrides.
                    //
                    ConfigureOverrides(e.Cell.Node, overrideField);
                    break;
                case "Override Min Length":
                    ProcessLengthChanges(e.Cell, true);
                    break;
                case "Override Max Length":
                    ProcessLengthChanges(e.Cell, false);
                    break;
            }

            OnChanged();
        }

        private bool IsNodeOverrideRequired(UltraTreeNode node) {
            UltraTreeNodeCell cell = node.Cells["Override Required"];

            bool cellVal = Convert.ToBoolean(cell.Value);
            bool ctlrValue = ((UltraCheckEditor)cell.EditorControl).Checked;

            return Convert.ToBoolean(node.Cells["Override Required"].Value);
        }

 

Here is where I asign the editor and the edit permissions.   Visually everything is working well for the check box.   The numeric is not workign at all :(

            //
            // Configured Required cell
            //
            node.Cells["Override Required"].Value   = overrideField.Required;
            node.Cells["Override Required"].Tag     = overrideField;
            //
            // Only allow the user to change the required setting if the DB does not require it
            //
            if (!overrideField.DbRequired()) {
                node.Cells["Override Required"].AllowEdit = AllowCellEdit.Full;
            } else {
                node.Cells["Override Required"].AllowEdit = AllowCellEdit.Disabled;
            }

 

I've tried everything for about a week now and I just can't get the editors to work.

The 2005 version of Infragestic at least came with demo programs you could play with to get ideas.  However the 2008 version has no examples or demo programs you can look at. :( 

Parents
  • 69832
    Offline posted

    I didn't look into everything you mentioned here but regarding the subject of this thread, I verfied that the CellValueChanged event is behaving as expected for the CheckEditor:

    void treeControl_CellValueChanged(object sender, CellValueChangedEventArgs e)
    {           
        Debug.WriteLine( string.Format( "CurrentValue = {0}, OriginalValue = {1}", e.CurrentValue, e.OriginalValue ) );
    }

    This code produced the expected result.

    Regarding samples/demos: the the best of my knowledge, all release versions include product samples, unless during the install you elect not to copy them.

Reply Children
No Data