Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Define Nested Containership Programatically
Message
From
28/11/2001 18:51:32
 
 
To
28/11/2001 18:15:40
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00587247
Message ID:
00587261
Views:
34
This message has been marked as a message which has helped to the initial question of the thread.
Hi Randy,

You need to re-jig the class code a little bit. Like this:
RELEASE x
PUBLIC x
x=CREATEOBJECT("temp")
x.visible=.T.
x.Show()

DEFINE CLASS temp AS form
DoCreate = .T.
Caption = "Form3"
Name = "temp"

ADD OBJECT container1 AS Mycontainer WITH ;
  Top = 84, ;
  Left = 48, ;
  Width = 276, ;
  Height = 72, ;
  Name = "Container1"

ENDDEFINE

DEFINE CLASS MyContainer AS Container
  ADD OBJECT text1 AS textbox WITH ;
  Height = 13, ;
  Left = 77, ;
  Top = 21, ;
  Width = 121, ;
  Name = "Text1"

ADD OBJECT text2 AS textbox WITH ;
  Height = 13, ;
  Left = 77, ;
  Top = 45, ;
  Width = 145, ;
  Name = "Text2"

ENDDEFINE
>How does one go about defining nested containership programitically? It works with simple ADD OBJECT lines for one level of nesting. Beyond that isn't so clear. The code produced by the Class Browser produces a syntax error when you try to compile it. For example, here is the beginning of what the CB produces for a form with a container that includes 2 textboxes:
>
>DEFINE CLASS temp AS form
> DoCreate = .T.
> Caption = "Form3"
> Name = "temp"
>
> ADD OBJECT container1 AS container WITH ;
> Top = 84, ;
> Left = 48, ;
> Width = 276, ;
> Height = 72, ;
> Name = "Container1"
>
>* Next line produces a syntax error, due to the dot notation:
>
> ADD OBJECT temp.container1.text1 AS textbox WITH ;
> Height = 13, ;
> Left = 77, ;
> Top = 21, ;
> Width = 121, ;
> Name = "Text1"
>
> ADD OBJECT temp.container1.text2 AS textbox WITH ;
> Height = 13, ;
> Left = 77, ;
> Top = 45, ;
> Width = 145, ;
> Name = "Text2"
>
>TIA,
>
>-- Randy
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform