-
Notifications
You must be signed in to change notification settings - Fork 961
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
Wrong text in ComboBox #8731
Comments
@Olina-Zhang Can your team please verify this? |
Verified this issue in .Net framework 4.8.1 and .Net Core different versions, all have same result: when using mouse move the mouse pointer over the list items, the value in text box area is not changed, and when using up/down keyboard to go through the list items, the value in text box area is changed. It seems a by design issue. |
Hi @Olina-Zhang |
@Olina-Zhang, as I can see you didn't reproduce step 5. |
@gc-maximloverov How you change the value from 111 to 555 in your sample? |
@Olina-Zhang to do this, you need to click on the button to open the drop-down list of elements with the mouse, then very quickly hover the mouse cursor over the "555" element. The main thing is the speed of hovering the mouse over the element "555", if it is not high enough, the problem will not be reproduced. This will take several tries. Restart the application if the attempt fails. In the video that I have attached, you can see how fast I move the mouse cursor. |
@gc-maximloverov our team memebers all tried this scenario with very quickly hover the mouse cursor over other elements, no textBox value changes. It's hard to reproduce. Did you have accidental mouse-click operation when moving cursor process? |
@Olina-Zhang, several our team members can successfully reproduce this issue. |
@Olina-Zhang I didn't have a accidental mouse click operation. Can you try when moving the mouse cursor over the list of elements not to point to the element "111", but immediately to "555"? |
@Olina-Zhang I have attached a project of a new test application, which, on pressing the "click me" button, reproduces the problem by simulating mouse control through the Windows API, can you run it and test it? When you click on a button, you do not need to move the mouse or press the buttons. |
@Olina-Zhang added HighDpi support to test app. |
@gc-maximloverov Thanks for your application, we tested it with some chance of reproducing this problem, but not 100%. In addition, when this problem is reproduced, then move mouse and click in form other place, the comboBox dropdown is collapsed, its textBox value is still "111", not "555" |
@Olina-Zhang Thanks. Will this problem be fixed? |
@gc-maximloverov this is an edge case, needs our engineer team to triage, @merriemcgaw what is your opinion? |
@Olina-Zhang, we have custom code in our controls which uses MeasureItem and DrawItem events. |
@denjmpr If this is causing problems for you and your customers. It might be a good idea to look into the problem yourself and possibly put in a MR fixing the issue. I am sure the team would be super grateful for the effort. |
@denjmpr this docs should get your started https://github.com/dotnet/winforms/blob/main/docs/developer-guide.md. You can add your sample to https://github.com/dotnet/winforms/tree/main/src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest project, set breakpoints and F5. |
Given that this is potentially related to the interaction between your code and the ComboBox, there's a better than even chance that the underlying common control is the source of the problem. CommonControls are not being enhanced anymore. |
This issue is now marked as "help wanted", and we’re looking for a community volunteer to work on this issue. If we receive no interest in 180 days, we will close the issue. To learn more about how we handle feature requests, please see our documentation. Happy Coding! |
Guys, I've tried to research it a little and what I've got for now:
So, might it be that the actual reason is inside some OS/Native code and I cannot figure it out? |
I'm not surprised at all to learn that the underlying OS is doing something odd between the VisualStyles ON and VisualStyles OFF modes. ProgressBar control with Visual Styles OFF can change the ProgressBar color, but Windows changed that ability in WinXP and now you can try to set a color but it won't do anything. My assumption at this is that this would be the native code, but I have a deeper philosophical question. My expectation as a user would be for the TextBox part of the control to update once focus has settled on a new value. Moving at that speed may not even register as setting the focus. Is this a particularly visible, problematic change in the OS for your apps? If so, I would file a Feedback Ticket via the Windows Feedback Hub in the OS. It should get routed to the right team. That said, they are not taking many (if any) changes to what is considered legacy UI, so the bar for getting a fix will require a strong business justification. If you have a support contract, consider using that to engage with the Windows team as well, you may get better results that way. Unfortunately, I don't think this is something WinForms will be able to impact. |
You could try with cpu speed reduced to e. g. 5 or 10 %. You can apply that in power settings in maximal CPU usage option. This might help "moving fast" the mouse compared to the redraw speed of the forms. |
@denjmpr you previously mentions a simplifying of the steps to reproduce. Could you provide them here incase anyone picks this issue up again? |
.NET version
6.0
Did it work in .NET Framework?
No
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No
Issue description
ComboBox is added to the form and DropDownStyle is set to DropDownList.
Multiple items added to ComboBox and SelectedIndex set to 0.
In runtime you need to click on the button to open the items list and very quickly move the mouse pointer to any other value in the list then 0.
ComboBox displays wrong value in text box area.
Further, if you move the mouse pointer over the list items, then the value in text box area no longer changes.
Also this problem is reproduced in DrawMode = OwnerDrawFixed.
Video:
![ComboBoxIssue](./?url=aHR0cHM6Ly91c2VyLWltYWdlcy5naXRodWJ1c2VyY29udGVudC5jb20vMTAzMDI3MzAwLzIyMjM3MzMyNi01N2ExZTkyZC1jODEwLTQyYmYtOGY3OC0xNDk2YTk2NzljZjYuZ2lm&__proxy_form=0)
Steps to reproduce
The text was updated successfully, but these errors were encountered: