TechTricks
Technical answers from the trenches 
 
 
 
 

     
   
ObjectPAL: Passing Arrays to Libraries
 
   
 Posted: 23 August 2000
 
   
 
 Applies to: Paradox 5.ox and later
 
   
 
Audience: Intermediate
 
       
   

Question: How do I pass arrays or dynarrays to libraries?

Answer: Declare and use a custom type, like the ones shown here:

   type
      arrayAnytype = array[] anyType
      arrayLongInt = array[] longInt
      arrayString = array[] string

      dynarrayAnytype = dynarray[] anyType
      dynarrayLongInt = dynarray[] longInt
      dynarrayString = dynarray[] string
   endType

Once you've declared the custom types, replace the types of your current variable declarations with the names of your new types. For example:

   astrAvailableValues array[] string
   astrSelectedValues array[] string

Becomes:

   astrAvailableValues arrayString
   astrSelectedValues arrayString

Once you've done this, you can declare methods in libraries and forms using the new types. From example, here's the declaration of a method designed to let the user choose a set of values from a standard "dual-list" dialog:

   method showDualList( astrAvailable arrayString,
                        astrSelected arrayString ) Logical

A demonstration form is available in our Download section; this illustrates several ways this technique can be used in your ObjectPAL code.

 

       

Top

Feedback About Paradox Delphi Assorted Web Stuff
 
 
Copyright © 2000-2004, techtricks.com; All Rights Reserved.
Acknowledgements, Disclaimers, Terms and Conditions.
Article last updated on 31 May 2003

 

Other Sites: Paradox, Delphi, Perl, Web Stuff, and More


 

[- End -]