Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Define Class/Add Object structure - 1 level nesting only
Message
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00514461
Message ID:
00514545
Views:
11
>Hi!
>
>I always thought the PRG file created by Class Browser could be compiled. And VCX file allows multiple nesting, but PRG does not? Its strange. What if you have a form with pageframes, grid etc etc?
>

>In addition, when I want to define the grid class in the PRG, how do I add the controls into the columns and how I add custom header controls? I see no way but changing all code to use the AddObject...
>

As I said, I believe it is a limitation of the ADD OBJECT syntax. I think you can get what you want by using the Init of your containers. Instead of using ADD OBJECT in the class definition, use that for first-level containership and override the Init of those containers to add additional objects. Ex.
define class MyGrid as Grid
ColumnCount=2
Procedure Column1.Init
   With THIS
      .RemoveObject("Header1")
      .NewObject("Header1","MyHeaderClass","MyHeaderClasslibrary")
   Endwith
Endproc
Enddefine
At the top most class level, you can define or override any method of anything in the hierarchy.

>
>>Vlad,
>>The Class Browser is notorious for producing crap when dealing with containership issues. When doing this in the past, I have had to create the lowest container as a class and use ADD OBEJCT at the next container with the newly defined class. Keep doing this up the line. This may be a limitation of the ADD OBJECT construct, but I think (not sure) you can define all your methods using mulitple dot notation.
>>
>>Procedure AAA.Area1.Line1.Click
>>
>>>Hi!
>>>
>>>I never worked with the large number of classes defined by DEFINE CLASS statement, so I ask maybe I miss something.
>>>
>>>I have tried to use Class Browser to convert some of my forms and VCX classes to the PRG-like definition. It is converted to something like following:
>>>
>>>
>>>DEFINE CLASS aaa as container
>>>
>>>Add Object area1 as container with ...
>>>
>>>&& here is a problem
>>>Add Object aaa.area1.line1 as line with ...
>>>...
>>>
>>>
>>>When compiling such PRG file, it shows syntax error on the second Add Object.
>>>
>>>The question is: how to define level 2 and more nested objects in the objects tree? Yet I managed only level 1 of objects work. In othe words, how to define object that is in container, that is in container?
>>>
>>>TIA.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform