Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

Sys(2013)

This function gives you a character string containing the pad and bar names of all the system menu items. We haven’t found much use for it over the years, especially since the same information is available in the online help in a much easier to read format.

Usage

cMenuItems = SYS(2013)

The list is space-delimited.

It seems to us that this list might be more useful if it were contained in an array rather than a single character variable. So the example below shows a function which parses the list into an array.

Example

* MakeMArr.PRG
* make an array out of the system menu pad and bar names
* Returns the number of items found
* If there's a parameter problem, returns -1.
* Sample Call:
*        nMenuCnt = MakeMArr(@aMenuItems)

PARAMETERS aMenuArr
* Have to pass menu in so it exists in calling program.

LOCAL cMenuString,nCnt,nNextPos
* cMenuString holds SYS(2013) return
* nCnt is a counter
* nNextPos = position of next blank in string

* Make sure we've got an array
IF TYPE("aMenuArr[1]")="U"
* bail out
   RETURN -1
ENDIF

cMenuString=SYS(2013)

* Now parse the string
* and create an array item for each item there
nCnt=0
DO WHILE NOT EMPTY(cMenuString)
   nNextPos=AT(" ",cMenuString)
   IF nNextPos<>0
      nCnt=nCnt+1
      DIMENSION aMenuArr[nCnt]
      aMenuArr[nCnt]=LEFT(cMenuString,nNextPos-1)
      IF nNextPos<LEN(cMenuString)
         cMenuString=SUBSTR(cMenuString,nNextPos+1)
      ELSE
         cMenuString=""
      ENDIF
   ENDIF
ENDDO

RETURN nCnt

See Also

Define Bar, Define Menu, Define Pad, Define Popup