Problem with numericUpDown Control

0
0

Hi,

I update from 1.4.50 to 1.4.80 today and have some problem with numericUpDown on some CRUD forms.

When edit with keyboard a numericUpDown value binding to a bindingsource and without lost focus press a toolbox button with bindingsource.EndEdit() code in Click Event, the underlying datasource don’t show the change.

Using mouse wheel or + – buttons works ok.

Using Wisej 1.4.50 works ok.

Using OK code into button (no toolbox button) works ok.

See sample proyect attached.

Thanks in advance,

Mariano

Attachment
  • You must to post comments
0
0

Attached sample, anyway this.validate() solved the accelerator problem.

Thanks.

 

Attachment
  • Luca (ITG)
    Got it. But the accelerator doesn’t trigger any validation by default so the binding cannot be updated. EndEdit() is not related to reading the property changes. See my previous message about the DataSourceUpdateMode enumeration. It’s OnValidation by default. Also Close() on a modal dialog doesn’t trigger validation (like WinForms) but we are changing it to behave like a non-modal form. So Validate() won’t be necessary anymore.
  • You must to post comments
0
0

Thanks. The  problem is that there was a bug in the toolbar that causes the control with the focus to lose the focus when clicking a button in the toolbar, which then in turn caused the Validating events on the control losing the focus, which activated the data binding. That has been fixed so the toolbar buttons do not steal the focus and do not cause validation.

Data binding can get updated in three ways: Never, OnPropertyChange or OnValidation. See DataSourceUpdateMode, it’s the last optional argument in new Binding(). The default is OnValidation.

We also added CausesValidation to the toolbar. So you can either change the binding to OnPropertyChange which will update the data source on each Value change, or set this.toolbar1.CausesValidation = true, which will validate when you press Ok without stealing the focus.

There is also a different behavior (which is identical to WinForms – but I think we probably want to change it) between modal dialogs and forms – modal dialogs do not trigger validation when closed and close even if a field fails validation, while forms always validate the active control and refuse to close if validation fails.

 

 

  • Mariano
    Thanks Luca, awesome support. CausesValidation=true works, but when toolbox button is clicked via Accelerators problem persist. Greets, Mariano
  • Luca (ITG)
    Give me an example of the Accelerators? You can also add Validate() before Close(). In Winforms modal dialogs are NOT validated when closed, but we will probably change it in Wisej and trigger validation when closing modals.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.