home *** CD-ROM | disk | FTP | other *** search
- /* XScrollList version 1.0.5, 27-SEP-1992 ⌐1992 A.D. Software
-
- THIS IS NOT FREE - see Shareware Details at end.
-
- OVERVIEW
-
- XFCN for presenting dialog boxes with a single list of items, for FoxBase+/Mac.
-
- ALSO A "Dump" feature is incorporated ╤ the array loaded can be dumped to a
- text file at very high speed. Carriage returns are used to separate items and
- so this may be useful as an fast export facility that allows export of TRIMMED
- fields & expressions.
-
-
- Multiple fields can be specified, using expressions, allowing combinations of
- related fields. eg:
- "trim(sample->name-"-chr(34)-":"-chr(34)-"-code)"
- which combines the fields sample->name and code with a colon between them and
- all trailing spaces removed.
-
- Tabs are used to align items into separate columns; tabs in a single field
- will have the same effect.
-
- Selection can be made by:
-
- 1. double-clicking on a line.
- 2. single-clicking on a line, then pressing the OK button.
- 3. single-clicking on a line, then pressing the Return key.
- 4. typing the first letter(s) of a selection, then doing 1,2, or 3.
- (Note: type selection assumes that the lines are ordered alphabetically)
- 5. scrolling with up and down arrow keys, then doing 1,2 or 3.
-
- Multiple Selections can be added by:
- 1. shift-click to mark all between original and shift-clicked selection
- 2. command-click to select or de-select individual items
-
-
- IMPORTANT
- For a comprehensive list of which of the following features are yet to be
- implemented, see the bottom of the document. I am releasing the product in its
- current state as it satisfies most needs (including my current app) and I want
- some shareware return before I can justify the time to complete the remaining features.
-
- PERFORMANCE HINTS
- The Record Number option on the Load (necessary to support returning
- record numbers) will slow down the load. If you are loading an indexed field
- it may be faster to specify a variable for the Display option to return the
- entry text, and use that text in a SEEK.
-
- Depending on your data, it may be faster to use field expressions without
- TRIM or use field numbers which perform no trimming. The bottleneck seems to
- be FoxBase, but it obviously costs you more memory to leave the blanks at the
- end of fields.
-
- Underestimating the number of records and/or average record size will have a
- direct impact on Load performance, as it has to expand handles for each record!
-
- If you are loading a file that has relations to other files, turning off
- relations will speed up the Load. You can turn them back on immediately after.
-
- Display is faster if the tabbing facility is not used.
-
-
- COMMON CAUSES OF ERRORS and SUDDEN CRASHES (Bus Errors, etc.)
- Specifying a Fox expression in the Load that doesn't actually work.
-
- Changing the numbering of the first four items of the dialog resource
- (See the "D" case for details on how these items are used).
-
-
- DETAILS OF USE
-
- SUMMARY OF ERROR RETURNS
- -1 = unspecified error
- -2 = unable to allocate memory
- -3 = no dialog resource
- -4 = specified array doesn't exist
- -5 = not enough parameters for this option
- -6 = unknown case
- -7 = unable to create text file
- NOTE: the return status is a CHARACTER variable - evaluate with val(status)
-
-
- DETAILS OF DIALOG RESOURCE
-
- The resource is not re-sized or re-positioned in any way from your definition (note the System
- 7 capabilities for auto-positioning, able to be set by ResEdit 2.1).
-
- Certain basic elements are presumed to be present (note the Apple guidelines say the OK button
- should be on the RHS of the dialog, with Cancel to its left, on English script systems):
- 1 OK button (name unimportant, outlined & activated by Return or Enter)
- 2 Cancel button (name unimportant, activated by command-period or esc)
- 3 Runtime-replaceable title (if parameter not specified, is left as is)
- 4 User item for list
-
-
- DETAILS OF FUNCTIONS
-
- COMMON PARAMETERS
- 1 = Function switch value in first character
- I Init XCMD (perform ONCE)
- C Cleanup array (perform at least ONCE, possibly more)
- L Load Array
- D Display Dialog
- F File the data in a text file
-
- 2 = array number (if storing multiple arrays), omit or zero if using default
- (except for where specified)
-
- Other parameters vary according to switch. Some options will also have Modifier characters following the
- switch character. Neither the Function switch or Modifiers are case sensitive.
-
- Note: declare the result variable in advance (eg: res = 0)
-
- Case I - Init XCMD
- PARAMETERS
- 2 = (optional) number of arrays you will need - saves a bit of memory movement later
-
- RESULT size (bytes) of array
- ERROR RESULTS -1 = unspecified error
- -2 = unable to allocate memory
-
-
- Case C - Cleanup
- 2 = array number (omit to cleanup all)
-
- RESULT undefined
- ERROR RESULTS -1 = unspecified error
- -4 = specified array doesn't exist
-
-
- Case L - Load Array
- ASSUMPTIONS
- - current file (or related files if using field expressions) is/are
- positioned at the 1st rec to load
-
- - if loading record numbers, it is only for the current file. The record
- number is retrieved BEFORE the field expression, in case the field
- expression has side-effects.
-
- MODIFIERS
- R - load record numbers (needed to support returning record number
- from dialog) creates a second array and loads the record numbers
- at the same time as loading the fields.
- > - Sort ascending
- < - Sort descending (mutually exclusive)
- # - Sort numerically instead of alphabetically
-
- NOTES
- The load process starts from the beginning of the array and expands to fit
- but doesn't shrink the memory already allocated (if allocated at an
- earlier Load). Call the Cleanup with this array number to remove the array.
-
- You can significantly improve the performance of the load by specifying the
- number of recs to load, as well as the optional "estimated record size". This
- enables the load function to pre-allocate the space rather than having to
- expand the array space as each record is loaded - a time-consuming overhead!
-
- PARAMETERS
- 2 = array number
- 3 = number of recs to load, zero = load to EOF
- 4 = estimated average record size (used to increase performance)
- 5 = command to skip to the next record (eg: "SKIP", "SKIP 10", "CONTINUE")
- 6 = field number from which to load array (in current file)
- OR
- field expression
- eg1: "otherFile->Name"
- eg2: "trim(surname-"+chr(34)+", "+chr(34)+"-othername)" && trim max spaces
- eg3: "code+chr(9)+trim(descr)" && tab to always indent descr same amount
-
- RESULT zero = loaded OK
- or
- size (bytes) of array needed that failed to be allocated in expanding
- (note that this could be a recno or data array, if using "R" modifier)
- ERROR RESULTS -1 = unspecified error
- -2 = unable to allocate memory
-
-
-
- Case F - File to text file (*** ,maybe buggy - see end)
- 2 = array number
- 3 = name of text file
- 4 = signature of text file creator (eg: 'McSk')
-
- NOTE
- Overwrites the file without warning.
-
- RESULT undefined
- ERROR RESULTS -1 = unspecified error
- -4 = specified array doesn't exist
- -7 = unable to create text file
-
-
-
- Case D - display dialog
- MODIFIERS
- > - Sort ascending
- < - Sort descending (mutually exclusive)
- # - Sort numerically instead of alphabetically
- M - multiple selections
- R - retain previous selections (ie: ignore a blank param 4)
- E - return only elements of a tabbed display (eg: E1 returns the text of the
- element(s) up to the first tab, E2 between the 1st & 2nd tabs etc.)
- T - tab size in pixels for regular tab stops (eg: T40)
- F - Font name & size for list contents (eg: F'Helvetica'8) default is Chicago 12
-
- PARAMETERS
- 2 = array number
- 3 = dialog resource id (eg: 1001)
- 4 = text to match for first item selected
- OR
- name of array containing multiple items to match
- OR
- leave blank to clear current selection & start with no selection (see flag R)
-
- 5 = text to substitute into dialog field number 3 (reserved for user-defined
- prompt)
- 6 = quoted name of optional variable to receive name of button pressed
- 7 = quoted name of optional variable to receive text of entry selected
- (receives an array if the Multiple selection option on)
- 8 = quoted name of optional variable to receive record number of entry selected
- (assuming the "R" modifier on the Load to also load record numbers, receives
- an array if the Multiple selection option on)
-
- eg:
- CALL xscrolllist TO res WITH "D" , 0 , 1001 , "c" , "The Title" , "btnVar" , "entryVar" , "recVar"
-
-
- NOTES
- SORTING
- If a sort is specified in the Load then there is no need to specify again at dialog display
- time, unless you want to sort in a different order. (eg: you could have a button on the
- dialog used to flip the sort order between ascending and descending, so you would call the
- dialog again after the user hit the button, with the opposite sort order).
-
- ELEMENT return
- If your element is an odd number of characters then there is a bug in FoxBase that
- will return an extra character, you may need to use code like:
- entryvar=iif(right(entryvar,1)=chr(9),left(entryvar,len(entryvar)-1),entryvar)
- or just
- entryvar = left(entryvar,3) && hardcoded item length
-
-
- RESULT number of item chosen, zero if none or Cancel
- OR
- number of selections (if Modifier M)
- ERROR RESULTS -1 = unspecified error
- -3 = no dialog resource
- -4 = specified array doesn't exist
-
-
-
-
- Case G - (*** not yet implemented - see end)
- get value(s) from list, using same match criteria as Dialog selection
- (returns data exactly as if the user just OK'd the initial selection)
- MODIFIERS
- M - multiple values
- E - return only elements of a tabbed display
-
- PARAMETERS
- 2 = array number
- 3 = text to match for first item selected
- OR
- name of array containing multiple items to match
- 4 = quoted name of variable to receive text of entry selected
- (receives an array if the Multiple selection option on)
- 5 = quoted name of optional variable to receive record number of entry selected
- (assuming the "R" modifier on the Load to also load record numbers, receives
- an array if the Multiple selection option on)
-
- WARNING (may not apply - check when I implement!)
- Destroys current selection in list - the items matched in this operation are left
- selected.
-
- ELEMENT return
- See notes under Case D - Dialog display
-
- RESULT number of item found, zero if none or Cancel
- OR
- number of selections (if Modifier M)
- ERROR RESULTS -1 = unspecified error
- -4 = specified array doesn't exist
-
-
-
- ***************************************************************************
-
- YET TO BE IMPLEMENTED
-
- Case D - display dialog Modifiers
- MODIFIERS
- F - Font name & size for list contents (eg: F'Helvetica'8) default is Chicago 12
- R - retain previous selections (ie: ignore a blank param 4)
-
- setting initial values in case M multiple selection
-
-
- Case F - File to text file
- may have some bugs, hasn't been tested since MAJOR changes
-
-
- Case G - get value(s) from list
- not yet implemented
-
-
- FUTURE IDEAS (please give your feedback)
- A form of Quick dialog which allows specification of the item names via
- a Fox array, or character string, to save on the complexity of managing arrays.
-
- Buttons and/or keystrokes that jump to the prev/next marked element on a
- multiple - selection list.
-
- Updates in-place of single array items.
-
- Control over list colour.
-
- Control over list style.
-
- User-written comparison & search functions (C or Pascal, compiled as "pure
- code resources").
-
- ***************************************************************************
-
-
- SHAREWARE DETAILS
- Godfather Holdings Pty Ltd as trustee for the Dent Family
- Trust Trading as A.D. Software
- Australian Company Number 009 453 007
-
- Contact: Andy Dent BSc, MACS
- 94 Bermuda Drive, Ballajura Western Australia 6066
- Phone/Fax: (09) 249 2719
- International: 61 9 249 2719
- CompuServe: 100033, 3241
- Internet: dent@dialix.oz.au
-
- PAYMENT VIA
- International Money Orders
- Australian dollars cash
- Australian bank or personal cheques (made out to A.D. Software)
- Visa, Mastercard or Australian Bankcard
- **CompuServe users - I will be registering this software under SWREG, which enables you
- to pay me by CompuServe (GO SWREG for details).
-
- FEE & UPDATE DETAILS
- The fee is $50 Australian (due to our rotten exchange rate this is about $36 US).
- Registered users will receive free upgrades with notices mailed (electronically
- where possible) of new versions being uploaded, and available on disk for a
- nominal shipping fee, on request.
-
- A second fee (same amount) is requested for the use of the source code (registered
- users get the right to ask "why the !@#$ did you do it that way!?!") :-)
-
- OTHER FOXBASE XCMDS
- XBrowse2Click - provides trapping of double-click, Tab, Enter & Return keys to generate
- a command key of your choice. Perfect for adding double-clicking etc. to your BROWSE!
-
- XGetDepth - returns the pixel depth (ie 2, 4, 8, 16 or 32) of the screen (freebie)
-
-
- OTHER PRODUCTS & SERVICES
- A.D. Software is a custom software development house ╤ if you have any other
- XCMD or other programming requirements, please contact me for further information.
-
- Major products include a FORTRAN->Pascal translator and multi-user classified
- advertisement publishing system.
- ---------------------------------------------------------------------------------*/
-