-
Notifications
You must be signed in to change notification settings - Fork 695
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
Added Text Alignments. and fixes #583. Changed Clicked from Action to EventHandler per tenets. #621
Conversation
This is really good work. I don't think we can accept this until we have a clear conversation with @migueldeicaza on backwards compat. Most of these changes from If you look at the inventory I created in #447, I suggested how we could do this in a way that is backwards compatible. To be clear, my opinion is that we do what you have done and "do it right" and not clutter the code with a ton of legacy APIs. But Miguel knows more about what he's promised existing users and I think it is his call on whether we do this or not. Because of this, it might be a good idea to break your |
I have never really liked EventHandlers, going all the way back to WinForms, and would rather use Actions which were introduced later. Is there a reason to embrace that idiom, other than "This is what .NET in 2001 did"? |
Yes, I think I and others pretty clearly made the case for them here: Action was not invented to replace EventHandler but to compliment it. Action lacks pub/sub multiplexing, which is really important for UI idioms where multiple pieces of code want to subscribe to an event. We could build a pub/sub model on top of Action, but then.... @migueldeicaza please read and comment on this: #447 |
It really gets a little difficult to work like that. If it is to impose big changes, the sooner the better, that is, before version 1.0 and not after getting used to the new model where you will see that there are different treatments for the same events. @migueldeicaza really @tig is right to adopt |
…ion to EventHandler per tenets.
9c8bb5b
to
431c37a
Compare
One thing that many folks do not realize is that every .NET delegate is multicast, which means that this works and does not even need "Action" to be flagged as an event:
And this calls both methods. The scenario that @BDisp mentions is the demultiplexing of code, which is a rarely used feature, and everyone has to pay the price for it. A solution that made sense when we did not have lambdas. Nowadays the same demultiplexing can take place inline:
Now, these are all old-way of managing events. A more interesting discussion is whether embracing System.Reactive is the right approach, as it is a better framework for reasoning about events than these hooks. |
We will have to pay a price for that, but with the increasingly powerful machines I think it would be insignificant. For me you are the master and your opinion counts a lot and what you decide I will always follow :-) |
Ok, I was obviously wrong on @BDisp thanks for your work on this PR, but we are not going to merge it at this time. |
Certainly @tig I understand. I will then submit the |
It would be awesome if you took a swing at re-factoring the keyboard events using the draft guidelines I just put here: https://github.com/migueldeicaza/gui.cs/wiki/Framework-Design-Guidelines |
@tig I already have three Views ready to submit PR and they all use |
I think so. This is all my fault because I pushed forward without waiting to hear from @migueldeicaza. Sorry about that. Let's look at it as an opportunity to do it right and do it consistently though! ;-) |
@tig do you mean these?
|
Well, those are the event raising functions, but, yes, those are the events I was asking about. To be clear on what I'm asking:
I was hoping you'd take a look at those events and see how hard it would be to convert them to be |
I don't think it's that hard. I will contribute the best I can. |
I'm a +1 for @migueldeicaza #reactive suggestion especially given the power of linq over events :D |
@tig changing from |
In the cases where |
I found this into
|
No description provided.