Sign in to follow this  
  • entries
    4
  • comments
    2
  • views
    3731

You received a InvalidDesignEvent

Sign in to follow this  
assainator

369 views

Last past week I moved back to square one as I found out that THE most important thing in my UI framework, the event handling mechanism, was AWFULLY designed. I never came to the idea that some might need to redirect the events to another handler.

Now that's a real stupid mistake.

Take for example the spin control. A textbox with two buttons.
As soon as the textbox' value changes, a callback is called, but the textbox is part of a spinctrl, this would mean another Functor, another call.
For simple controls like spin controls, this won't be a big problem, but once one get to larger controls, this means a lot of rerouting.
Now, with the new design, a user can simply set a pointer to the parent handler and all messages are nicely sended there and nobody has to care about them anymore
Now I know that this still means another function call (SendMessageToParent(Event evt) ), but this way of handling events allows me to dump my template Functor into the trash bin. These template Functors forced me to put everything that needed some sort of callback (such as controls) into headers, significantly increasing compile times and causing debugging to take a lot longer as well




And there are two more bright spots about this redesign:
- development speed - controls don't need no more large declarations, most of the event handling is already done in the lowest base class
- code cleanness - all headers are much cleaner as the code moved to the source files.

I hope that everybody who reads this (if anybody reads this), will take a bit more time to make a proper design now as you can see to what kind of horrors this (not taking enough time for designing) leads.




See you next time.
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now