TweetFollow Us on Twitter

OpenDialog Review

Volume Number: 13 (1997)
Issue Number: 5
Column Tag: Tools Of The Trade

OpenDialog

by Edward Ringel

Specialized dialog functions library for the industrial strength programmer

The Dialog Manager is a flexible package that is used by almost everyone creating forms for Macintosh applications. For some applications, these forms are limited to setting preferences or a few other limited tasks. In this situation, extensive customization of the dialog is unnecessary, and Toolbox calls are more than sufficient. In other circumstances, a series of dialogs, modal and modeless, may be the core of the project and represent the bulk of the user interface. In these applications, customization of the dialogs may be desirable and even mandatory. In this setting, the direct Dialog Manager calls may be clumsy and require large amounts of coding to achieve input filtering, relating data structures to items, cursor management, and the like.

Object oriented technologies have devised schemes to exercise considerable control over forms-style GUIs. Procedural programmers usually have a collection of routines and libraries tucked away which simplify the problem, at least to a degree. From time to time various programming tools become available which also purport to simplify the life of the dialog-forms programmer. OpenDialog is such a package.

Dialog Manager Replacement

OpenDialog is engineered and supported by FGM, Inc. of Herndon, VA. This company's primary business activity is writing end-user software, not creating programming tools. Nonetheless, their collection of routines and their systematic approach to addressing Dialog Manager problems and deficiencies resulted in a library that clearly has commercial appeal. As FGM states in its ads and introductory literature, this is a replacement for the Dialog Manager. It is recommended that you do not use OpenDialog and Dialog Manager calls on OpenDialog dialogs because, as the manual says, "the results may be unreliable."

When OpenDialog creates a new dialog (modal, moveable modal, and modeless dialogs are all supported) it creates private data structures and tags the dialog as its own. The library supplies a function, DMX_ItzaODlogWindow(), to test whether a dialog belongs to the OpenDialog manager or not. As a replacement for the Dialog Manager, OpenDialog has an equivalent function for just about all of the Dialog Manager functions.

With the exception of a few calls, the replacement function and the original function have very similar names and parameter lists; this is obviously helpful and important. Parameter lists are different when functionality is extended. DMX_GetNewDialog() may be a good example; this function's parameter list allows the programmer to specify if the dialog is to be modal or modeless, to assign a text style for the dialog, and to set flags for event handling.

As may be apparent from these two function call examples, the function calls all start with DMX_; this permits easy differentiation from Toolbox calls in your code. Throughout the library, there is a clear and consistent nomenclature that was very easy to follow; this helped shorten the learning curve considerably.

Extensions to the Dialog Manager

Clearly, one does not purchase a library to simply have a different prefix to a function. OpenDialog provides a very wide range of extensions to the services provided by the Toolbox.

One very nice feature of the product is item tagging. Every item in a dialog can have text associated with it; OpenDialog takes advantage of this to allow for customization of the item at the resource level. As I describe below, one powerful use of this feature is to customize an edit field to create filtering. Another is to "name" an item and free the programmer from needing to remember a DITL number. Controls and other elements may also be customized with item tagging. I think that the ability to set filtering (and other services) at the resource level is in the best spirit of Macintosh programming tools.

The largest (and probably for many programmers, the most important) group of services have to do with editable text boxes. By tagging the edit text item's default text in the resource editor, one can limit the number of characters in an entry, force numerical data only, etc. Getting and setting data from a text box is much, much easier than with Toolbox calls. To get any item's text, one simply calls pascal void DMX_GetItemText(const DialogPtr aDlog, short aItemNumber, Str255 aString), and to set the text, one calls the counterpart function, pascal void DMX_SetItemText(const DialogPtr aDlog, short aItemNumber, const Str255 aString). Specialized getters and setters for date, time and latitude and longitude are also supplied. Although one might functionally group cursor control with other types of service extension, the library supplies an automatic I-Beam cursor if the field is initialized correctly. To give a flavor of OpenDialog calls, below is a listing from a short program I converted to OpenDialog. This function creates a modeless dialog, counts the number of dialog items, tests to see if the item is of type editText, and if it is, installs automatic I-Beam management.

void CreateModelessDialog(short DialogID, DialogPtr *theNewDialog)
{
 short  tempType;
 short  numItems;
 short  i;

 *theNewDialog = NULL;
 *theNewDialog = DMX_GetNewDialog
 (DialogID, kDMX_Modeless, 0L,kDMFlag_DoIdleEvents);
 if (*theNewDialog !=NULL) {
 numItems = DMX_CountDITL(*theNewDialog) +1;
 for (i=1;i<numItems; i++){
 tempType = DMX_GetItemType(*theNewDialog,i);
 if (tempType==editText)
 DMX_SetIBarFlag(*theNewDialog,i,true);
 }
 ShowWindow(*theNewDialog);
 SetPort(*theNewDialog);
 }
 return;
}

OpenDialog also supports a variety of extensions to the dialog manager that are not directly edit-field related. Among others, OD has scrollable text, twisters (Finder type triangles), and specialized support for multiple pane dialogs. Although some elements, such as lists, are not supported directly, there is help provided with functions such as DMX_CouldFocus(), which allows the active user item to receive keyboard events.

OpenDialog contains a number of very valuable utility functions. It has a fairly large subset of ANSI library and other string and number utility functions, which eliminate dependence on much of the ANSI library functions. There's a nice call that gets extensive volume information. There are several functions for putting up a quick "question" alert, an error message alert, and a password dialog.

Perhaps of greatest utility are the callback functions. One can attach a callback to any item for any purpose. (Well, I guess I'm exaggerating a little, but you really can attach a callback to any item.) Event handlers, specialized update routines, data entry filters, cursor callbacks, action procedures and the like can all be attached with relative ease. While this part of the package has the steepest learning curve, it clearly also holds the most bounty. Since much of the interaction is with the Toolbox, many of the callbacks are framed as Universal Procedure Pointers, and appropriate macros are provided. All in all, this is a very robust package.

What OpenDialog is Not

OpenDialog is not a GUI builder, nor is it an application shell. This is a replacement and extension to the Dialog Manager, and no other services are provided, except in bits and pieces. For example, in my program which I converted to OD, I still had to SetPort() on my own after bringing a modeless window to the front. Window Manager routines work on OpenDialog dialogs without difficulty, and are used extensively when working with modeless dialogs. I think it is particularly important that OpenDialog's limitation be recognized. The novice or early intermediate programmer will certainly be able to use the package, but will feel somewhat unsupported in the lack of event loop support and help with printing, etc.

Documentation

The documentation of this package is difficult to characterize, as parts of it are very good, and other parts are problematic. There is an initial short introduction to the OpenDialog programming paradigm, and the remainder of the manual is a description of all the functions. The document, as I received it, was in e-doc format and about 12 months out of date. A large supplement of functions had been added and were in a Simple Text "Read Me" file.

The documentation present is quite good. The function descriptions follow a nice format, and I knew how to use a given function after reading the manual section describing it. The introduction gave me a good general feel for how the guys at FGM were approaching the dialog problem. e-doc format does not permit hypertext cross referencing - I think this is a must for electronic documentation; I would very much have liked to see some means of accessing a function description rapidly. I was unhappy that the manual was dozens of new functions out of date.

The primary instruction for the real-life use of the program is in the sample program and the DMC.h header file. The sample program is large, complex, and somewhat hard to follow; the demo shows off the features nicely, but I would have preferred a series of smaller programs that were easier to read and digest. My test conversion program used modeless dialogs, and there was no demonstration of how to use OpenDialog for modeless dialog work. An email to FGM resolved this quickly, and Charlie Vass, the engineer, was most helpful. When all is said and done, the information is there, and describes the product correctly, but could do with improvement in formatting and accessibility.

The Bottom Line

OpenDialog is a set of powerful routines that can simplify life tremendously for programmers pushing the Dialog Manager to its limits. I could see this product being quite helpful to anyone developing complex electronic forms in a procedural language. There is probably less of a need for this product with object oriented frameworks, given the design paradigm of a window view object populated by other views object. This product should not be used by a novice programmer.

OpenDialog is available directly from FGM for US$ 259. The package consists of documentation, a header file, and both 68K and PPC libraries for CodeWarrior. Libraries are available for the Symantec environment. All functions are declared pascal, and the commercial package comes with a Pascal interface file.

OpenDialog Lite is a free, limited version of OpenDialog (lacks some of the newer functions and does not have any documentation except for the sample program and header file) and is available on the CW 11 disk. It's a great way to test drive the product. I urge anyone with some programming experience and a need for sophisticated forms to look into this package.

Products Reviewed in this Article

OpenDialog, version 1.2.3 using C interface and CW 10.

Usefull URL's

<www.fgm.com>

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Top Mobile Game Discounts
Every day, we pick out a curated list of the best mobile discounts on the App Store and post them here. This list won't be comprehensive, but it every game on it is recommended. Feel free to check out the coverage we did on them in the links... | Read more »
Price of Glory unleashes its 1.4 Alpha u...
As much as we all probably dislike Maths as a subject, we do have to hand it to geometry for giving us the good old Hexgrid, home of some of the best strategy games. One such example, Price of Glory, has dropped its 1.4 Alpha update, stocked full... | Read more »
The SLC 2025 kicks off this month to cro...
Ever since the Solo Leveling: Arise Championship 2025 was announced, I have been looking forward to it. The promotional clip they released a month or two back showed crowds going absolutely nuts for the previous competitions, so imagine the... | Read more »
Dive into some early Magicpunk fun as Cr...
Excellent news for fans of steampunk and magic; the Precursor Test for Magicpunk MMORPG Crystal of Atlan opens today. This rather fancy way of saying beta test will remain open until March 5th and is available for PC - boo - and Android devices -... | Read more »
Prepare to get your mind melted as Evang...
If you are a fan of sci-fi shooters and incredibly weird, mind-bending anime series, then you are in for a treat, as Goddess of Victory: Nikke is gearing up for its second collaboration with Evangelion. We were also treated to an upcoming... | Read more »
Square Enix gives with one hand and slap...
We have something of a mixed bag coming over from Square Enix HQ today. Two of their mobile games are revelling in life with new events keeping them alive, whilst another has been thrown onto the ever-growing discard pile Square is building. I... | Read more »
Let the world burn as you have some fest...
It is time to leave the world burning once again as you take a much-needed break from that whole “hero” lark and enjoy some celebrations in Genshin Impact. Version 5.4, Moonlight Amidst Dreams, will see you in Inazuma to attend the Mikawa Flower... | Read more »
Full Moon Over the Abyssal Sea lands on...
Aether Gazer has announced its latest major update, and it is one of the loveliest event names I have ever heard. Full Moon Over the Abyssal Sea is an amazing name, and it comes loaded with two side stories, a new S-grade Modifier, and some fancy... | Read more »
Open your own eatery for all the forest...
Very important question; when you read the title Zoo Restaurant, do you also immediately think of running a restaurant in which you cook Zoo animals as the course? I will just assume yes. Anyway, come June 23rd we will all be able to start up our... | Read more »
Crystal of Atlan opens registration for...
Nuverse was prominently featured in the last month for all the wrong reasons with the USA TikTok debacle, but now it is putting all that behind it and preparing for the Crystal of Atlan beta test. Taking place between February 18th and March 5th,... | Read more »

Price Scanner via MacPrices.net

AT&T is offering a 65% discount on the ne...
AT&T is offering the new iPhone 16e for up to 65% off their monthly finance fee with 36-months of service. No trade-in is required. Discount is applied via monthly bill credits over the 36 month... Read more
Use this code to get a free iPhone 13 at Visi...
For a limited time, use code SWEETDEAL to get a free 128GB iPhone 13 Visible, Verizon’s low-cost wireless cell service, Visible. Deal is valid when you purchase the Visible+ annual plan. Free... Read more
M4 Mac minis on sale for $50-$80 off MSRP at...
B&H Photo has M4 Mac minis in stock and on sale right now for $50 to $80 off Apple’s MSRP, each including free 1-2 day shipping to most US addresses: – M4 Mac mini (16GB/256GB): $549, $50 off... Read more
Buy an iPhone 16 at Boost Mobile and get one...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering one year of free Unlimited service with the purchase of any iPhone 16. Purchase the iPhone at standard MSRP, and then choose... Read more
Get an iPhone 15 for only $299 at Boost Mobil...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering the 128GB iPhone 15 for $299.99 including service with their Unlimited Premium plan (50GB of premium data, $60/month), or $20... Read more
Unreal Mobile is offering $100 off any new iP...
Unreal Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering a $100 discount on any new iPhone with service. This includes new iPhone 16 models as well as iPhone 15, 14, 13, and SE... Read more
Apple drops prices on clearance iPhone 14 mod...
With today’s introduction of the new iPhone 16e, Apple has discontinued the iPhone 14, 14 Pro, and SE. In response, Apple has dropped prices on unlocked, Certified Refurbished, iPhone 14 models to a... Read more
B&H has 16-inch M4 Max MacBook Pros on sa...
B&H Photo is offering a $360-$410 discount on new 16-inch MacBook Pros with M4 Max CPUs right now. B&H offers free 1-2 day shipping to most US addresses: – 16″ M4 Max MacBook Pro (36GB/1TB/... Read more
Amazon is offering a $100 discount on the M4...
Amazon has the M4 Pro Mac mini discounted $100 off MSRP right now. Shipping is free. Their price is the lowest currently available for this popular mini: – Mac mini M4 Pro (24GB/512GB): $1299, $100... Read more
B&H continues to offer $150-$220 discount...
B&H Photo has 14-inch M4 MacBook Pros on sale for $150-$220 off MSRP. B&H offers free 1-2 day shipping to most US addresses: – 14″ M4 MacBook Pro (16GB/512GB): $1449, $150 off MSRP – 14″ M4... Read more

Jobs Board

All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.