>I'm currently trying to create a object oriented menu system, and get rid of all boring .mpr files... But now I have a problem with the usage of the class, the syntax I want dosn't work. Here is an example:
>
>oMenu = createobject('menu')
>oMenu.AddPad('FileMenu', 'File')
>oMenu.AddPad('EditMenu', 'Edit')
>
>(So far so good, to pads are showing in my window...)
>
>But if I want to hide a pad I want to write:
>
>oMenu.Pad('EditMenu').HidePad()
>
>But then this error shows up: Invalid subscript reference.
>
>But if I do it this way everything works fine:
>
>oPad = oMenu.Pad('EditMenu')
>oPad.HidePad()
>
>Is there some way to get the short version to work? It looks so much nicer and as far as I know this is possible in many other languages.
>
>/Mårten Törnquist
You're trying to access the objects as a collection, which doesn't work in VFP as it doesn't support real collections. You'll have to use the code that works.
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer