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

The Legend of Heroes: Trails of Cold Ste...
I adore game series that have connecting lore and stories, which of course means the Legend of Heroes is very dear to me, Trails lore has been building for two decades. Excitedly, the next stage is upon us as Userjoy has announced the upcoming... | Read more »
Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »

Price Scanner via MacPrices.net

Limited-time sale: 13-inch M3 MacBook Airs fo...
Amazon has the base 13″ M3 MacBook Air (8GB/256GB) in stock and on sale for a limited time for $989 shipped. That’s $110 off MSRP, and it’s the lowest price we’ve seen so far for an M3-powered... Read more
13-inch M2 MacBook Airs in stock today at App...
Apple has 13″ M2 MacBook Airs available for only $849 today in their Certified Refurbished store. These are the cheapest M2-powered MacBooks for sale at Apple. Apple’s one-year warranty is included,... Read more
New today at Apple: Series 9 Watches availabl...
Apple is now offering Certified Refurbished Apple Watch Series 9 models on their online store for up to $80 off MSRP, starting at $339. Each Watch includes Apple’s standard one-year warranty, a new... Read more
The latest Apple iPhone deals from wireless c...
We’ve updated our iPhone Price Tracker with the latest carrier deals on Apple’s iPhone 15 family of smartphones as well as previous models including the iPhone 14, 13, 12, 11, and SE. Use our price... Read more
Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more
Updated Apple MacBook Price Trackers
Our Apple award-winning MacBook Price Trackers are continually updated with the latest information on prices, bundles, and availability for 16″ and 14″ MacBook Pros along with 13″ and 15″ MacBook... Read more
Every model of Apple’s 13-inch M3 MacBook Air...
Best Buy has Apple 13″ MacBook Airs with M3 CPUs in stock and on sale today for $100 off MSRP. Prices start at $999. Their prices are the lowest currently available for new 13″ M3 MacBook Airs among... Read more

Jobs Board

Solutions Engineer - *Apple* - SHI (United...
**Job Summary** An Apple Solution Engineer's primary role is tosupport SHI customers in their efforts to select, deploy, and manage Apple operating systems and Read more
DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying, Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.