Closed overlinejota closed 2 years ago
KMaskedTextbox is also affected. Also happens with the "Validating" event.
When set to false non of the events is triggered.
KryptonMaskedTextBox.CausesValidation = false;
KryptonTextBox.CausesValidation = false;
This link could be helpful https://stackoverflow.com/questions/30759864/winforms-firing-enter-event-twice
@Smurf-IV Is this linked to the fixes that were merged yesterday?
@Smurf-IV Is this linked to the fixes that were merged yesterday?
Do not think so, Did not look at any impact in this area as I was in the Dock and ribbon projects
@Smurf-IV Is this linked to the fixes that were merged yesterday?
Do not think so, Did not look at any impact in this area as I was in the Dock and ribbon projects
Is this just missing the 'Focus()' call in the validate event?
I have the same situation and I created a project to demonstrate
This also affects other controls like KDomainUD
It is because
VisualControlBase
is based on the winforms Control
Validated
EventHandlerOn#####()
version, thus triggering it twice.This could take a while to fix, e.g. just "some" of the eents in the KDominUD:
private void OnDomainUpDownTextChanged(object sender, EventArgs e) => OnTextChanged(e);
private void OnDomainUpDownScroll(object sender, ScrollEventArgs e) => OnScroll(e);
private void OnDomainUpDownSelectedItemChanged(object sender, EventArgs e) => OnSelectedItemChanged(e);
private void OnDomainUpDownGotFocus(object sender, EventArgs e)
{
UpdateStateAndPalettes();
PerformNeedPaint(true);
InvalidateChildren();
base.OnGotFocus(e);
}
private void OnDomainUpDownLostFocus(object sender, EventArgs e)
{
UpdateStateAndPalettes();
PerformNeedPaint(true);
InvalidateChildren();
// ReSharper disable RedundantBaseQualifier
base.OnLostFocus(e);
// ReSharper restore RedundantBaseQualifier
}
private void OnDomainUpDownKeyPress(object sender, KeyPressEventArgs e) => OnKeyPress(e);
private void OnDomainUpDownKeyUp(object sender, KeyEventArgs e) => OnKeyUp(e);
private void OnDomainUpDownKeyDown(object sender, KeyEventArgs e) => OnKeyDown(e);
private void OnDomainUpDownPreviewKeyDown(object sender, PreviewKeyDownEventArgs e) => OnPreviewKeyDown(e);
private void OnDomainUpDownValidated(object sender, EventArgs e) => OnValidated(e);
private void OnDomainUpDownValidating(object sender, CancelEventArgs e) => OnValidating(e);
Q: Should the OnDomainUpDownGotFocus
be rewritten to not call the base class, because it will end up calling it twice ?
A: Maybe; who knows for each Krypton control !!
I was going round in circles for months trying to track down this bug!
@Smurf-IV What happens if you "disable" Krypton's implementation & use the standard WinForms validation calls?
@Smurf-IV What happens if you "disable" Krypton's implementation & use the standard WinForms validation calls?
It will work as expected.. It's just all the the other event handlers that will need consideration ! Trouble is when Krypton needs to do something with the event and then calls the base anyway..
Update: Darn it.. Keep going round in circles when trying to apply to all Krypton controls.. This bug is entrenched too deeply in some places, and I haven't even moved into Ribbons yet !
I'm going to focus on just this control, so that it can be validated by @overlinejota as soon as a fix is published. Otherwise there would be too many controls updated tat would remain untested fro a long time. @Wagnerp will need something on the landing page asking for instances of "Double events" to be raised ASAP so that they can be worked on in turn with active users ready to "Test" the result.
@Smurf-IV Ok, will broadcast a message out on Discord too
FYI: Reason for separate controls updates;
In the above by just "Removing things that just call through to the base" shows the the click events are no longer working in the KryptonTextBox
Done, with a few other events as well:
PR coming soon
A simple form with a KrytonTextBox and a button. The next code wave twice when KryptoTextbox1 loses focus:
Thanks;