-
Notifications
You must be signed in to change notification settings - Fork 436
Add TextBox event handlers #3289
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
Add TextBox event handlers #3289
Conversation
For indication whether text has been commited (internally, whether OnCommit has been invoked).
*(what was I doing)*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should it even be valid to have a text box that has both ReleaseFocusOnCommit
and CommitOnFocusLost
set? That just sounds broken by design, I'm not sure why someone would want to shoot themselves in the foot with that gun.
out-of-scope for this PR but definitely something to open an issue for, in fact, some of the |
It is out of scope here but I'd argue it needs to be a prereq PR as the |
Why though? this could be useful to block committing on certain conditions with its sub-classes not required to duplicate the checks and just early-return if Might as well force that on all overridable functions. |
I'd have to see a concrete convincing example that justifies this. Just the ability to do so doesn't convince me as it is added complexity, and I'm not sure that it's necessary. |
After rethinking this a bit, this should definitely be valid, this type of maybe rewriting the check to commit on focus lost only if there is new committable text and remove the early-return check on |
OK, I agree, if those behaviours are separate they do make more sense, but the double commit still does not. Still a matter for a separate PR, with proper tests and documentation. |
I don't think tests are needed, it's a matter of code quality. I'm pretty sure documentation isn't even needed after separating the checks. (you'll see) |
The publicly-exposed flags steer behaviour the stability of which is important to framework consumers, therefore I'd say it needs to be covered with tests to avoid regressions (which, FWIW, goes for as much public framework API as possible). |
This would allow for better invoking OnTextAdded(...) and OnTextRemoved(...) without introducing more unnecessary parameters (like suppressing event invokes)
…ction *I have an issue with writing which direction I'm imagining...*
@bdach I've resolved the double-commit fuzz with an internal I've also merged |
Will be removed in the other PR along all other sample playback in here.
Co-authored-by: Dean Herbert <pe@ppy.sh>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR overall is really difficult in reviewing. There are changes all over and it's hard for me to confidently arrive at the conclusion that this won't break things.
OK I will split all changes into separate PRs, although I put them here just for them to make sense where they belong, but sure if it helps reviewing. |
Will leave this unchanged until the prerequisites are merged, then I'm gonna resolve conflicts afterwards. |
Could do with some conflict resolution now. |
I ... have no clue how this got removed
Would have been nice to have some very simple test coverage of these events, but I guess it's fine as-is. |
Allows for adding custom logic when something happens to a
TextBox
, will come in handy for moving audio samples from the abstractTextBox
to osu!lazer's.Also has other changes:
Commit()
return type tobool
for indicating that a commit actually occurred. (to avoid potentially executing custom logic onCommit()
2 times whenReleaseFocusOnCommit
andCommitOnFocusLost
are both set)