Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: KryptonNumericUpDown.TextAlign doesn't work properly #37

Closed
Ahmed-Abdelhameed opened this issue Dec 19, 2020 · 9 comments
Closed
Labels
bug Something isn't working
Milestone

Comments

@Ahmed-Abdelhameed
Copy link
Contributor

Describe the bug
The alignment of the KryptonNumericUpDown's text doesn't work properly when the text is being edited. as shown in the gif below.

To Reproduce
As demonstrated below:

  1. Add a KryptonNumericUpDown control (its text alignment should be Center by default).
  2. Move the focus in and out of the control and/or start typing.

Expected behavior
The text alignment should be the same whether or not the text is being edited.

Screenshots
NUP

Desktop:

  • OS: Windows 10
  • Build: 2004.

Additional context
The issue happens when the TextAlign property of the internal _numericUpDown WinForms control doesn't match the text alignment set for the Krypton NUP control. This happens in two cases:

  1. By default, the alignment is set to Center but _numericUpDown.TextAlign is Left. This is probably caused by the following point anyway.
  2. When the .Content.TextH of a state (e.g., StateCommon) is changed, it doesn't affect the TextAlign property.

I noticed that the TextAlign property does set the _numericUpDown.TextAlign property accordingly. But since the former has a [Browsable(false)] attribute, I'm assuming it's not to be used, in favor of the TextH property (which fails to update the _numericUpDown.TextAlign property).

So, the fix should be either to update _numericUpDown.TextAlign each time TextH is changed or if TextAlign is what should be used (I doubt it), make it visible and hide TextH instead.

@PWagner1
Copy link
Contributor

@Smurf-IV Would this be a similar bug as referenced in #20?

@Smurf-IV
Copy link
Member

@Smurf-IV Would this be a similar bug as referenced in #20?

#20 is font Selected issue (Via "Krypton Selected" values not being used I suspect)

@Smurf-IV
Copy link
Member

Smurf-IV commented Jan 9, 2022

This has (at least) 2 issues
OnMouse leave removes the Highlight (as per #38 ) which causes the edit to change
The Edit window is a different layout / control to the numeric display, and does not always perform a proper overwrite to f the edit control area

@giduac
Copy link
Contributor

giduac commented Feb 7, 2022

Hi, (@Smurf-IV @Ahmed-Abdelhameed)

I'd like to add some findings to this that I came across when using this control.

If the keyboard-cursor is in the control and the mouse pointer is not over the control:

  • Win7/8 the mouse wheel can still scroll the value up or down.
  • Win10/11 the above is only possible if the mouse pointer is over the control. The keyboard focus is maintained.

This behaviour also applies to other types of controls (Listbox / ComboBox / DomainUpDown, etc.) and is there (has been changed) since Win10. This has nothing todo with the Krypton controls. Standard Winforms Controls have the same behaviour.
Run the program on W7/8 and you'll see the difference.

The KryptonNUD control does not have the ability (like the Winforms one) to position the cursor on the value with the mouse and start editing at the selected position (see video). Aligning the value left or right makes no difference.
EDIT: I tried this also on a Kdomainupdown. This control also has mainly the same erratic behaviour as the K-NUD.

DP7bHlZzOc.mp4

@Smurf-IV
Copy link
Member

Smurf-IV commented Feb 27, 2022

Solved initial opening point with as part of #39
@giduac Please retest when the new nightly is produced, and create separate Bugs for the points that you are mentioning - Thanks

@giduac
Copy link
Contributor

giduac commented Feb 28, 2022

@Smurf-IV
Tested with Nightly .59
KNUD control now works as it should and the cursor can be aimed and placed on the desired location.

Opened a new ticket for KDomainUpDown
#660

@Smurf-IV
Copy link
Member

Smurf-IV commented Mar 1, 2022

@Smurf-IV Tested with Nightly .59 KNUD control now works as it should and the cursor can be aimed and placed on the desired location.

Great

Opened a new ticket for KDomainUpDown #660

Good practice.. Thanks

@giduac
Copy link
Contributor

giduac commented Mar 1, 2022

@Smurf-IV
This can be closed then ... ??

@Smurf-IV
Copy link
Member

Smurf-IV commented Mar 1, 2022

It already was:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants