ftp.nice.ch/pub/next/developer/resources/palettesfor2.xx/EntryCheckForm.README

This is the README for EntryCheckForm.N.bs.tar.gz [Download] [Browse] [Up]

GENERALFORM PALETTE

GeneralForm is an expandable Interface Builder palette used for checking the validity of user input.  The types of data that will be accepted by individual fields within the Form can be set from within IB, rather than through programming methods.

For example, if one wanted to have a Form that accepted a non-negative integer in the first field and a social security number in the second field, one could simply drag over a GeneralForm, select the first field, then pick an entry type from a scrolling list of possiblilities.  The second field's entry type could be set in a similar manner.  Because all source code is included, the programmer can easily add his own field entry types.

GeneralForm takes a different tack for validating user entry than that suggested by NeXT in the mini examples (FilterFunctions, available from the archive servers).  NeXT overrides the Text object's filter function to look at each keystroke as it comes in.  This allows them to do some nifty things, like perform validation on each character as it comes in.  This palette, as implemented, only checks the data when editing ends (eg, when the user presses 'return').  I find it disconcerting to have the computer modify my data entry or stop me in mid-stream, though that's a personal preference of mine.  Anyway, I'm simply suggesting that there's another way to do things, and pointing out where you can learn more about it.

(Note also that my approach is sort of a bogus design, in that general behavior is being subclassed from more specific behavior.  C'est la vie.)

USING THE PALETTE

Uncompress and untar the archive file.  Change to the directory created and type 'make install'.  That will compile the palette and put it into the directory ~/Palettes.  In IB, select Tools->Load Palette, then navigate to the ~/Palettes directory and select the Palette.  A new Palette will appear in the Palettes window, which you can drag over to your applicaton just as the standard Form object can be. Once the object has been dropped into a window and has been made the active selection, you can inspect it by picking the 'Attributes' option in the Project window.  

The entry types of individual fields within the form are set by selecting the field, then selecting the field entry type from the scrolling list in the IB cell attributes inspector.  (Select the attributes option from the Project window when the cell is selected.)

To compile the program correctly, you need to incorporate the palette code into the project in some way.  Probably the easiest way is to just include the GeneralForm.[h|m] and GeneralFormCell.[h|m] source code files into the project.  Another way would be to include the .h files and the compiled .o files.  See NeXTanswers ib.606 for more information. (NeXTanswers is available from the archive servers.)

CREATING NEW FIELD ENTRY TYPES

This is fairly straightworward.  Simply write a new method in the GeneralFormCell class that performs the entry validation on the string entered.  Include the name of the method in the "class" variable at the top of the GeneralFormCell.m file, including the colon at the end.  Recompile the palette; the new method will be available for selection in the scrolling list.

It's also possible to subclass the GeneralFormCell class.  If you do this, you should modify GeneralForm to include the new subclass as its prototype cell.

POSSIBLE IMPROVEMENTS

Lots 'o stuff.  More field data entry checkers, to begin with.  There are only a few there now.  An hierarchical browser for field entry types when the number of fields does get big.  A normal name-to-method name lookup function, so the programmer doesn't have to see the actual method names in the IB inspector.  The Form inspector is re-implemented here so you can modify that if you like.

LEGAL STUFF

I'm not responsible for any bugs, and there is no warranty of any kind including any implied warranty of fitness for a particular use.  You may freely copy and use this code for any purpose.  However, you may not charge anyone else for it.  Orignal attributions and copyright notices must remain. The usual GNU rules apply.


MANIFEST

-rw-r--r--  1 mcgredo      460 Mar 30 11:44 GeneralForm.h
-rw-r--r--  1 mcgredo     1263 Mar 30 11:43 GeneralForm.m
-rw-r--r--  1 mcgredo     3678 Mar 30 11:31 GeneralForm.nib
-rw-r--r--  1 mcgredo     2033 Mar 30 22:16 GeneralForm.rtf
-rw-r--r--  1 mcgredo     1354 Mar 24 14:28 GeneralForm.tiff
-rw-r--r--  1 mcgredo     2001 Mar 30 11:38 GeneralFormCell.h
-rw-r--r--  1 mcgredo    13142 Mar 29 23:50 GeneralFormCell.m
-rw-r--r--  1 mcgredo     8239 Apr  1 23:30 GeneralFormCell.rtf
-rw-r--r--  1 mcgredo      812 Mar 30 11:37 GeneralFormCellInspector.h
-rw-r--r--  1 mcgredo     3471 Mar 30 11:35 GeneralFormCellInspector.m
-rw-r--r--  1 mcgredo     2157 Mar 28 20:22 GeneralFormCellInspector.nib
-rw-r--r--  1 mcgredo     2390 Apr  1 23:44 GeneralFormCellInspector.rtf
-rw-r--r--  1 mcgredo     1302 Mar 29 19:39 GeneralFormH.tiff
-rw-r--r--  1 mcgredo      724 Mar 30 11:40 GeneralFormInspector.h
-rw-r--r--  1 mcgredo     6669 Mar 30 11:39 GeneralFormInspector.m
-rw-r--r--  1 mcgredo    15708 Mar 30 00:05 GeneralFormInspector.nib
-rw-r--r--  1 mcgredo     2432 Mar 30 22:17 GeneralFormInspector.rtf
-rw-r--r--  1 mcgredo       18 Mar 24 14:28 IB.paletteheader
-rw-r--r--  1 mcgredo      843 Mar 24 14:28 IB.proj
-rw-r--r--  1 mcgredo      711 Mar 24 14:28 Makefile
-rw-r--r--  1 mcgredo      176 Mar 24 14:28 Makefile.postamble
-rw-r--r--  1 mcgredo     4915 Mar 30 14:16 README


Don McGregor
mcgredo@bluto.ie.orst.edu (for a little while longer, NeXT mail OK)
mcgregdr@conan.ie.orst.edu (for a bit longer than that, normal mail only)

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.