Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to force a C5 error (Ch 1)
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00822713
Message ID:
00822851
Vues:
19
Hi Terry,

I think that the source of the problem is simply that when Foxpro tries to return focus to the Commandbutton it has been destroyed....

Here's a stripped down version of your code that demonstrates the same error:
* C5.prg
CLOSE ALL
RELEASE ALL
CLEAR ALL
PUBLIC frmC5
frmC5=CREATEOBJECT('subform')
frmC5.SHOW
READ EVENTS
CANCEL

DEFINE CLASS subForm AS FORM
  NAME='frmC5'
  BACKCOLOR=RGB(255,0,0)
  AUTOCENTER=.T.
  PROCEDURE QUERYUNLOAD
    CLEAR EVENTS
  ENDPROC
  ADD OBJECT cntbig AS subBigContainer
ENDDEFINE

DEFINE CLASS subBigContainer AS CONTAINER
  BACKCOLOR=RGB(255,255,255)
  ADD OBJECT cntSmall AS subSmallContainer
ENDDEF

DEFINE CLASS subSmallContainer AS CONTAINER
  * Uncomment next line to get C5  <<-----------------------------
  * ADD OBJECT cmdRemoveObj AS subRemoveObj
  PROCEDURE CLICK
    THISFORM.cntbig.REMOVEOBJECT('cntsmall')
  ENDPROC
ENDDEF

DEFINE CLASS subRemoveObj AS COMMANDBUTTON
ENDDEFINE

* END C5.PRG
Didn't have time to play with this for long but it also seems that the behaviour only occurs with a nested container - removing 'cntBig' with a contained commandbutton doesn't cause a problem...

Regards,
Viv
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform