Article ID: 109230
Article Last Modified on 10/15/2003
* Load FoxTools
IF !'FOXTOOLS'$SET('LIBRARY')
SET LIBRARY TO FOXTOOLS ADDITIVE
ENDIF
* Get the name of the boot volume
sysDrive = JustDrive(FXSystem(0))
* Remove the trailing colon
sysDrive = LEFT(sysDrive, LEN(sysDrive) -1)
* Create a popup containing all the volumes to which the Mac is
* currently connected. The boot volume, the one containing the active
* System Folder, is the default choice. Note the space after the caret
* in the PICTURE clause.
@1,1 GET m.volPop PICTURE '@^ ' + FXVolume() DEFAULT sysDrive
READ && Activate the list object
NOTE: Replace the row and column coordinates of the popup with ones that
reflect the desired position of the object. For more information about the
@ ... GET LIST command, see the FoxPro "Language Reference."
PROCEDURE AVol
* Procedure to create an array of available volumes.
* The parameter must be passed by reference. When the procedure is
* finished, the parameter will contain an array of the available
* volumes.
PARAMETER a_Volume
IF PARAMETERS() < 1
WAIT WINDOW 'Usage: =AVOL(@<expC>)' NOWAIT
RETURN 0
ENDIF
*Open FoxTools if necessary
IF !'FOXTOOLS'$SET('LIBRARY')
SET LIBRARY TO FOXTOOLS ADDITIVE
ENDIF
* Get a semicolon-delimited list of available volumes
volList=FXVolume()
* Get the number of volumes in the list
numVols = Words(volList,';')
* Dimension the array to hold the volume names
DIMENSION a_Volume(numVols)
* Parse the list of volumes and stuff each value into its own array
* element
FOR i = 1 TO numVols
a_Volume[i] = WordNum(volList, i, ';')
ENDFOR
RETURN numVols
* END OF PROCEDURE AVol
To create the array for use by a popup or list object created in the
FoxPro for Macintosh Screen Builder, initialize a variable and call
procedure AVol in the Setup code snippet of the screen. For example:
* Place the following in the SETUP code snippet of a screen theVols = '' volCount = AVol(@theVols)In the Popup or List dialog box, specify theVols as the array that supplies the popup or list with data. For more information about creating popups and lists in the Screen Builder from an array, see the FoxPro "Developer's Guide." You can use a similar procedure in Visual FoxPro for Macintosh version 3.0b, by using properties specific to the listbox object in the Form Designer.
Additional query words: vFoxMac FoxMac FXVOLUME listbox pop- up list box
Keywords: kbcode KB109230