Initial GUI question, organization of different "looks",

I've done a lot of programming for the CLI and web already, but lately I've been getting desktop programming.

In most GUI programming tutorials, I'll just explain the different controls you can use and leave that to that. Some of the best ones also fix some usability issues.

However, my problem is not with the API, but with theory, but with my code.

How you should organize the various views your application might have (for example, an IM application has a login view, contact list view, conversation view, etc.).

Do they suggest that there should be different classes or different methods for the same class? Different panels that are hidden and open, or different windows in general?

I hope the answers are as language agnostic as possible, but in case that is not possible, the languages ​​/ frameworks I am considering are Java / Swing or C # / WPF. However, if there is another language / framework that is significantly better to learn, I would consider using that.

0


a source to share


4 answers


Typically, each view will be a separate class in a separate file. The class then most likely implements some base class like Window or Control.

As far as the organization is concerned, if it's a simple application, place them in the root directory or in the UI folder. Or perhaps the Window folder and the Management folder.



If it is a large application with multiple views, than break them down into functionality, that is the IM folder.

0


a source


I would say go with what Joshua said and using different panes that are hidden and uncovered I was working on old code and this is a reuse nightmare (8000+ lines of Delphi 6!) So stick with different windows like as much as possible!



0


a source


A generally recommended general program structure is the model-view-controller ( MVC ) structure type. So first of all, don't do the actual part of the view data, it goes into the model. From here, since the only data in each viewport now almost completely matches the layout and action information (click, data display, etc.), if they are different they should probably be different classes. If there is some general functionality that can be taken into account, you can make it a base class and inherit from it, but in the end, windows with different functionality should be different classes.

0


a source


If you are going to use one of the main IDEs, it will handle some of this work for you. By default, a different class will be used for each view. Hidden panels and tabbed interfaces are nice features, but they are doing themselves a favor and learning how to embed groups of controls into a form. Some structures allow you to directly insert one form into another. Others have special containers that can be embedded.

The point here is to break down your functionality so you don't end up with a bloated form class that is hard to slip through.

I would also spend some time on some architectural patterns to make your business logic stand out from your UI. Check out the link for a good starting point.

0


a source







All Articles