Under the Scope
Written by Brad Scharf
Welcome to 'Under The Scope'. Each month this column will feature at least one application that may be of use to OS/2 developers.
In EDM/2 issue 4-2 I did a review of JBA's Guidelines version 3.1 and promised several more articles on Guidelines. This issue I will present the first of these installments, except that now the version number is 3.2. The only part of the plan that has changed since the Guidelines review first appeared is that now, instead of doing three more articles as promised, I will probably do more than just three. Since these additional articles will be less of a review and more of a 'how-to,' the Guidelines series will not be presented at the expense of other product reviews (this month being an exception). In addition, at this point I can't guarantee that all Guidelines articles will appear back-to-back, but I will make every attempt to ensure that they are. In any case there won't be more than one issue between articles in this series.
As you all know, in order to make the best use of any application, it's necessary to be familiar with the interface, so that's what we'll look at this month. I'll give an overview the main parts of the interface, look at configuring the program in preparation for generating an application, and finally, will get familiar with some of the major components that make up this program. Components not covered this issue will be introduced and explained in future articles, when Guidelines receives its 'field trial' in EDM/2, that is, when we go through the development of an actual application or two.
Coming Soon To A Theater Near You
Well, maybe not a theater, but at least to EDM/2. Keep your eyes open for reviews of Virtual Pascal for OS/2 and Speed Pascal/2 as well as a couple of other OS/2 based Pascal compilers.
Have An Idea or Product?
If you have any suggestions for products you would like to see reviewed let me know! I'll entertain any suggestions. Likewise, if you or your company has a tool that OS/2 developers might be interested in hearing about don't hesitate to contact me.
Remember issue 4-1? I did a review of a utility called PSPM/2 v5.1. Well, the copy that I reviewed had been downloaded quite a while back, and not being able to find a more recent version I simply used the copy I had on disk. I shouldn't have done that! Unbeknownst to me, that program should not have been available to the public and, in fact, the author has been actively pursuing rogue copies of this application to ensure that it was no longer so. I apologize to the author and to you, the reader, for this and will strive to ensure that it does not happen again.
The Guidelines interface is not unlike any other PM program. All the standard components are present, as well as several other features that have become quite common, such as status bar, tool palettes and so on. In other words, at first glance (and I do mean first glance) there is nothing unique about Guidelines. Speaking for myself, this is good! Why?... because it flattens the learning curve. This is an important consideration for reasons of productivity alone, if nothing else. There is still a learning curve, but time can now be better spent learning JOT.
"What is JOT," you ask? It's another high-level programming language. While many developers may not like the idea of having to learn another language, there is a definite advantage here in that by using Guidelines and JOT you have multi-platform capabilities. If you're a professional devel oper you already know how useful it could be to write the application once and simply recompile for various platforms without having to perform major changes in the code. Those of you who have already spent vast amounts of time creating your own libraries haven't been forgotten either, as Guidelines does support third-party libraries. Adding C code to your programs is straightforward and easy. Just embed the C/C++ functions you would normally use into the JOT code modules. We'll look at how to do this in a future article.
When you first start Guidelines you'll see a screen much like this (but without the ellipses and big blue labels):
Figure 1) Guidelines main screen. (Click for large version.)
With the exception of the Menu Bar, the main components have been outlined for you in figure 1 and their uses are as follows:
Properties Bar - this consists of (in order from left to right) a name field for the selected control, a button to accept the settings for the control, another button to cancel changes to the control, a text field and a field displaying the position and size of the control. It's necessary to distinguish between the name and text fields here. The name is the name of the control as it will be known to Guidelines, whereas the text field contains the string that will be seen by the user, whether it be on a title bar or as a button label etc. Values can be edited directly in the fields themselves, or through the property settings dialog for the control in question.
Editor Toolbar - this allows you to bypass the menus to directly access many of the features of Guidelines, and it comes in two flavours, depending on whether you happen to be in GROUP mode (figure 2) or EDIT mode (figure 3).
Figure 2: Editor toolbar in Group Mode. (Click for large version.)
Figure 3: Editor toolbar in Edit mode. (Click for large version.)
Group mode serves to allow the sizing, alignment and positioning of controls. Edit mode, on the other hand, allows the creation of new controls in addition to editing capabilities. Several editing functions are shared between the two modes. More on this later.
Controls Toolbar - this allows point-and-click creation of new controls. The appearance of this toolbar will depend on which Guidelines extensions you have installed, which controls you have decided should appear, and where you have decided the toolbar should be located (top, bottom, left, right or floating).
Status Bar - provides info about the control under the cursor, time until next auto-save as well as a few display options, such as grid-toggle, hiding the Controls Toolbar, browsing through your application's windows and editing the current control.
Not labelled in figure 1, but present never-the-less, is the Work Area (analogous to the client window). When you create a Dialog or Frame control, they will appear in, but are not limited to, the Work Area. In fact, the entire frame window may be reduced in size such that only the toolbars are visible (see figure 4). In this case, the desktop itself can be used as the work area.
Figure 4: A possible view when using the Desktop as the Work Area. (Click for large version.)
As for the Menu Bar...I won't discuss it. It isn't that I don't think it's a nice Menu Bar because it is (as far as menus go), but it would be redundant to do so because virtually all operations can be performed using the toolbars or accelerator keys, so the menus will be left until needed. However, those who prefer to use the keyboard should take comfort in knowing that the menus are easily navigated and well designed.
Proper configuration is the key to successfully generating applications. Really. When you install Guidelines, the installation program does what it should: it creates all the necessary directories and does all that other installation stuff. In addition, it will also allow you to specify which disks should be searched for supported compilers. Now, instead of stating that this appeared to have worked flawlessly, I must confess that I couldn't tell if it didn't work! The reason is that I don't have a supported compiler (yet) so I skipped the compiler search. However, I expect to have a decent compiler by the time you read this, as well as some new stuff from JBA, so when I do I'll do the whole installation over again and let you know how it went. Anyhow, the reason I mention this is that my current installation left me with certain path settings for an IBM CSet/2 2.10 compiler (the one I told the installation program I had). If I had actually had the compiler installed, I would have done the compiler search and my hope for the next issue is that I'll be able to tell you that this sets all paths correctly and obviates the necessity of editing environment settings (within Guidelines). We'll see.
If you read the review of Guidelines in issue 4-1, you may be wondering by now how I could say then that everything worked well and now I can't. Here's why - in issue 4-1 I reviewed Guidelines version 3.1, which supported my compiler. The article you're reading now has been written using a test-drive version of Guidelines 3.2, which does not support my compiler. The reason JBA gave for this is because of changes in the libraries between versions. They also tell me that future versions will see more support for additional compilers, however, but in my case this is not true (although it would be if I were not using such old technology). But, despite not having a supported compiler at the time of writing, the interface is still usable and only when attempting to generate code will it become obvious that something is missing (my fault, not JBA's). Even without a compiler, it's still possible to write an application, test the JOT code for errors and even run the application from within Guidelines itself. Note, however, that running the application before generating is more an appearance-test than anything. The application won't be usable until the code has been generated and compiled.
Back to the Show
Now, when speaking of configuration, there are two flavours: configuring an application (source directories, etc.) and configuring compilers. The application-related settings will be left for a future article when we look at actually creating an OS/2 program using Guidelines. As for compiler settings, there is little, if anything, about compiler behavior that can't be modified. Take a look at figure 5 and you'll see...
Figure 5: Compiler settings. (Click for large version.)
Just about anything you would type from a command prompt can be modified here. In addition, if you require different settings for the same compiler, just add another compiler to the list, edit the configuration and use whichever environment is needed at a given time. Guidelines itself uses this method to generate object files with or without debugging code embedded in the generated files.
The only other big concern about compiler settings (and external tools in general) are the paths to these tools. There are two ways to point to the correct paths, and the following settings dialog will illustrate this:
Figure 6: Path Settings. (Click for large version.)
As you can see, paths may be set by filling in the fields, and the installation does much of the work for you, or you can tell Guidelines to use the settings from CONFIG.SYS. More on whether this works next time, when I expect to be able to test this with a supported compiler. Note: I added the 'BCOS2' stuff myself as an exercise in futility.
That about covers Guidelines setup! Most of the work involves not Guidelines, but your compiler! Chances are you've typed this stuff so many times on from a command line that once more won't hurt. Again, next time I'll let you know if it's possible to have the compiler stuff done for you at installation time, so stay tuned.
Other Major Components
Of these, perhaps the most important is the action editor. It is from here that you will add the actual JOT code. The editor automatically creates several code modules for you, such as for global variables, user-defined structures and external functions and so on.
Figure 7: The Action Editor. (Click for large version.)
From figure 7 you can see that, in addition to a Menu Bar, the Action Editor consists of an Event Selection Bar, a Work Area, Code Modules and the Editor itself.
The Editor - before deciding that the last thing you need is another editor consider that the built-in editor contains a "code prompter." You can write a lot of code without writing anything at all. Functions, events, methods, controls, ad infinitum can be added simply by clicking the mouse. Obviously, the code added in this manner will require some editing, but the developer's work is greatly reduced. In addition, it reduces the need to instantly recall the number of parameters required, as descriptive dummy variables are included at no extra charge. Simply replace them with your own and you're set. When familiar with JOT this will be a minor point, but for the newcomer every bit of help is welcome.
The Event Selection Bar - this allows you to select an 'object,' by which I mean an application-wide code module (global variables for example), or a major control window, such as frames and dialogs. If the 'object' selected contains other controls, such as text or buttons (and it will), then the Event Selection Bar allows the user to also select the desired control from the 'child' drop-down list box. Having done this, selecting an item from the 'event' list box takes you directly to the code module that deter mines behavior for that particular event. Note that the list of children will only contain those children belonging to the object, and the list of events will be specific to the selected child control, that is Btn1Down for a button event or VScroll for a window or List Box event and so on.
Each control that you create will cause another code module to come into existence, in effect leaving you with one function per source file. A finished application will consist of many code modules, which can make it troublesome to locate specific functions or can simplify code changes enormously, depending on how you look at it. This is a strong case for providing meaningful names to modules.
From the Action Editor, it is also possible to check the syntax of your JOT code (current or all modules) and to import or export code. By default, each code module is also checked when it is saved.
Well, that's about it for the interface. There isn't much to it when you think about it (and I say that with respect!). Next time I'll take a look at JOT, which wasn't discussed in the initial review of Guidelines so it will all be new and, I hope, interesting. Being a new language to myself and probably to most of you, I'm looking forward to it.
One final note: since this is not a review, there won't be a summary for this article, nor will there be a rating.