Sign in to follow this  
paic

Usefull concepts behind editors ?

Recommended Posts

Hi, I'm writing a scene editor around my engine, and I'm currently having a hard time figuring how to do it. For example, I have a TreeView reprensenting my scenetree. For each type of node, I'd like to be able to : 1) edit / see the content, depending on read / write accesses 2) create a new one 3) do probably other things I don't think of right now So for the moment, for each new node's type, I have to create 2 forms : one for creation, one for editing. That's fine. BUT I also need to update the contextual menus, and add ugly switches to create / show the correct edition / creation forms. And when the functionalities become more and more complex, I have a lot of "cross references". By this I mean that whole part of the editor need access to other parts of the editor, so each time I add new functionalities, I need to update tons of code ... So now, I'm searching for any concept / design pattern / whatever could help me reduce dependencies, make things a little more intuitive / automatic, etc. I don't know if I'm clear, but I hope I can learn interesting things :) don't hesitate to direct me to documentation, articles, etc. Thx in advance !

Share this post


Link to post
Share on other sites
By default the TreeView control is going to send notification methods to the message pump for the thread that created it, and these notifications tell you whenever the user does anything of interest. Why not, as you get these notifications, simply dispatch them to your separate sub-systems? This way the sub-systems don't need to communicate with each other directly (although they could through the same message-passing mechanism, if you wanted) and are instead all kept in sync by a central source. I like to also use messages to signal actions that can occur as a result of multiple actions, for example a simple clipboard copy (which can come from the window menu, an accelerator, a context menu, or a toolbar).

You definitely want to avoid having "cross-references" like you're talking about between your classes...too much coupling will make your code difficult to refactor and almost impossible to reuse. Instead try to have each component present a clean interface that requires outside code to "know as little as possible" about what actually happens in the object implementation.

Share this post


Link to post
Share on other sites
Quote:
Original post by MJP
You definitely want to avoid having "cross-references" like you're talking about between your classes...too much coupling will make your code difficult to refactor and almost impossible to reuse. Instead try to have each component present a clean interface that requires outside code to "know as little as possible" about what actually happens in the object implementation.


Yes I know that :) But what I'd like to know is what tools / design patterns / concepts / etc. will allow me to do this :)
For example, in my engine, once I discovered object factory, creation an manipulation of new node types was a lot easier than before.

I'm quite new to UI design and stuff like that. That's why I'd like to learn about it before starting to implement my editor, and be completely stucked in a few month because adding a simple tool requires to modify 100 files and 1000s of line of code to do so :)

Thx !

Share this post


Link to post
Share on other sites
Wow ... I thought this subject might be interesting for people sharing their tips on UI programming ... seems very few people are interesting in the subject or willing to share :(

At least, does somebody has a really good (and advanced) book on this subject to recommend ?

Share this post


Link to post
Share on other sites
The MVC pattern is rather useful in UI design, as it helps to separate the actual view of the data (ie. the UI) from the business logic and the data that it is representing.

I'm assuming you are writing this tool in WinForms (If not, shame on you). If so, I would recommend this book, which not only gives comprehensive overviews of all the important .NET controls, but also contains a wealth of information on creating custom controls as well as handy tips and tricks that aren't always so easy to find. Near the end the book also contains a chapter (although it's not long) on UI design principals, which is what you are looking for.

I find that the component based architecture of .NET helps keep my code clean. If you focus on writing each control to only handle its own logic and keep itself as one coherent entity, it becomes much easier to come up with a clean design.

Share this post


Link to post
Share on other sites
Quote:
Original post by Mike.Popoloski
I'm assuming you are writing this tool in WinForms (If not, shame on you).


A rather bigoted assumption, no?

Share this post


Link to post
Share on other sites

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

Sign in to follow this