Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Syntax problems when creating a menu class.
Message
From
08/02/2000 11:46:47
 
 
To
08/02/2000 10:41:41
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00328803
Message ID:
00328872
Views:
21
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform