Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Release a form
Message
De
18/11/2004 04:13:46
 
 
À
12/11/2004 11:37:24
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Versions des environnements
Visual FoxPro:
VFP 7 SP1
Database:
Visual FoxPro
Divers
Thread ID:
00960885
Message ID:
00962507
Vues:
18
This message has been marked as the solution to the initial question of the thread.
>Hi All
>Releasing a form with a lots of object(i.e. 2000) takes a while (5-10 sec)
>It looks to me that I'm missing something here because in VB works at once.
>

Hi Miroslav,

You can reduce the creation & destroy time (significant) if you split up (grouped) the object. I did a small modification from Hugo's code for testing. The example grouping the object using container. I use only 1 container in this example. And the result is just as slow as the original code. But..do play around with the "nTtlContainer" property (i.e.: 10, 20, etc ), you'll be surprise!
local loForm, lnStart

activate screen
clear

lnStart = Seconds()
loForm = Createobject('TestForm', 2000)
lnCreatedIn = Seconds() - lnStart

loForm.Show(1)

lnStart = Seconds()
loForm.release()
? 'Created in: ', lnCreatedIn
? 'Destroyed in: ', Seconds() - lnStart

define class TestForm as Form
   nTtlContainer = 1	&& Total Group to create. Play around with this value
   Closable = .F.

   add object cmdExit as CommandButton with ;
      Caption = 'Exit', ;
      Left = 0, ;
      Top = 0

   procedure cmdExit.Click()
      thisform.Hide()
   endproc

   Procedure Init( tnObjects )
      Local lcObjName, lnX

      With ThisForm
         For lnX = 1 to .nTtlContainer
            lcObjName = 'conTextBox' + transform( lnX )
            .AddObject( lcObjName, 'Container' )
         Next
         .SetAll( 'BackStyle', 0, 'Container' )
         .SetAll( 'BorderWidth', 0, 'Container' )
         .FillContainer( tnObjects / .nTtlContainer )
      EndWith
   EndProc

   procedure FillContainer( tnObjects )
      local lnObjects, lnObject, lcName, lnX, lcGroup

      lnObjects = Iif(Vartype(tnObjects) = 'N', tnObjects, 10)
      For lnX = 1 to ThisForm.nTtlContainer
         lcGroup = 'This.conTextBox' + transform( lnX )
         With &lcGroup
            for lnObject = 1 to lnObjects
               lcName = 'Object' + Transform( lnObject )
               .AddObject(lcName, 'Label')
            next
         EndWith
      Next
   EndProc
EndDefine
HTH
Herman
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform