Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Trying to call a container class
Message
De
26/12/2000 10:55:15
 
 
À
24/12/2000 14:03:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00456694
Message ID:
00456845
Vues:
26
>Hi...vfp6 user here
> I am trying to display a container class on a page in a pageframe.
> Would I:
> 1. Use CreateObject()
>OR 2. Use AddObject()
>
> AND
>
> Would I:
> 1. Put the code in the 'Activate' method of the page?
>OR 2. Put the code in the 'AddObject' method of the page?
>
> In any case, when I try:
> oObj = CreateObject('myclass','myclasslib'), then
>oObj.Visible = .t., I cannot see my class on the screen. It is there, because it is in the debugger.
>
>thanks, Randy

Cetin explained a "how" to do it, now here's an explanation of "where" and "why":

You could put your code in a lot of different places, like the Init method of the page or in the Activate method of the page, using the Page's AddObject method. You don't put code *in* the AddObject method, you *use* the add object method by calling it. So to add an object to the page (say a textbox):

Page Init method:
this.AddObject("YourNewControlName","TextBox")
WITH this.YourNewControlName
  .Left = 10
  .Top = 10
  .Visible = .T.
ENDWITH
Page Activate method (need to check if it exists first):
IF NOT PEMSTATUS(this,"YourNewControlName",5)
  this.AddObject("YourNewControlName","TextBox")
  WITH this.YourNewControlName
    .Left = 10
    .Top = 10
    .Visible = .T.
  ENDWITH
ENDIF
HTH
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform