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

Editbox losing focus triggers Editbox's OnEditboxChanged #8983

Closed
perezdidac opened this issue Apr 10, 2021 · 5 comments
Closed

Editbox losing focus triggers Editbox's OnEditboxChanged #8983

perezdidac opened this issue Apr 10, 2021 · 5 comments
Labels
question Further information is requested

Comments

@perezdidac
Copy link
Contributor

perezdidac commented Apr 10, 2021

Version of OpenTTD

Building at HEAD, 1.11+ I guess.

Expected result

  • Losing focus should not trigger OnEditboxChanged

Is this working as expected?!

Actual result

Losing focus triggers OnEditboxChanged

image

Steps to reproduce

  1. Enter text in a textbox
  2. Add a breakpoint to that window's OnEditboxChanged callback.
  3. Click somewhere else.
  4. Observe OnEditboxChanged is called
@LordAro
Copy link
Member

LordAro commented Apr 10, 2021

Should it not be triggered? The editbox has been changed - it is no longer focused! At the very least it needs to redraw the window without the cursor.

@michicc
Copy link
Member

michicc commented Apr 10, 2021

Also, when using an IME for text input, the edit box string can also change as we discard any non-commited IME input.

@TrueBrain
Copy link
Member

So running the OnEditboxChanged is intended. But I do wonder what you mean with It ends up triggering window invalidation again and again. ? It should only do it once for losing focus, so is there something we are not seeing there?

Tnx :)

@TrueBrain TrueBrain added the question Further information is requested label Apr 10, 2021
@perezdidac
Copy link
Contributor Author

So running the OnEditboxChanged is intended. But I do wonder what you mean with It ends up triggering window invalidation again and again. ? It should only do it once for losing focus, so is there something we are not seeing there?

Tnx :)

Nope, that was a mistake observation I made, it actually only triggers once. I will change the description to make it clear.

@perezdidac
Copy link
Contributor Author

Thanks for the responses. I guess this makes sense. I wonder if a OnEditboxContentsChanged callback would make sense, though probably not as I don't think there are even that many usages of OnEditboxChanged. Anyhow, I am closing this as it seems to be working fine and doesn't cause any trouble. It was nice to get some discussion on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants