09-05-2005 12:54 AM
09-05-2005 01:58 AM
Hi, Dave.
There is no real reason to make a separate UIR file for each panel, since the UIR editor accepts several panel into one single UIR file (I arrived at approx. 30 panel into one UIR, I don't know if there's a real limit on this...).
Said this, several words can be spent on "style", and I don't expect my way of programming to be an absolute reference
so I'll tell you what are my habits and maybe some others will do...
I work on relatively small projects, that use 10 to 15 panels. I organize the project in one UIR file and 2 (sometimes 3) source files. The primary source file includes the Main and all functions related to user interface, while other source files holds all general functions and in general all source code not directly related to user interface. In case reports are made by printing panels, a second UIR holds report templates.
I'm not really interested in having several source files since navigation inside the functions is quite easy knowing some keyboard shortcuts. When I work on a project, I always open source file in a regular order: first the source with the Main, then the others, so it's easy to go to one or the others using Ctrl-x shortcut. Ctrl-I when the cursor is on a function name moves you to its code, Ctrl-F moves you to a UIR object, right-click on a UIR object moves you to its callback...
Costs and benefits analisys:
By having few UIR files the number of project files reduces and it's easy to have project structure in mind.
On the contrary, if you must update a single panel of the applications, you must update the whole UIR file. Since I use to change file name when moving from one version to the next (filenames holds a progressive number for this reason) I use to put UIR filenames in macros and use them instead of the filenames inside the project, so while updating the project I'm not compelled to update every single LoadPanel. As an example:
#define UIR "myproject_xx.UIR"
#include "myproject_xx.h"
And inside the code I use
panelHandle = LoadPanel (0, UIR, "mypanel");
09-05-2005 06:11 PM