Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Define Nested Containership Programatically
Message
De
28/11/2001 18:51:32
 
 
À
28/11/2001 18:15:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00587247
Message ID:
00587261
Vues:
37
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform