Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
When does datasession change ?
Message
From
21/06/2001 16:06:41
 
 
To
21/06/2001 10:54:51
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00521629
Message ID:
00522153
Views:
13
Hi,
first something to try

You can access the datasession window with
SET VIEW ON
or
SET
in command window.

To check for unreleased forms enter MODIFY COMMAND in command window,
enter following program
LOCAL;
 loForm,;
 loTest,;
 lnLoop

lnLoop = 0
SET STEP ON
FOR EACH loForm IN APPLICATION.FORMS
*just Test Names in Debugger
 loTest = loForm.NAME
 lnLoop = lnLoop+1
ENDFOR loForm
and run from context menu.

I remeber "Kill Objects Dead" from Doug Hennig, an article in FoxTalk that discuss this problem.
If you own a copy of MSDN, it will be in the Periodicals / Periodicals 1999 / FoxPro / October /.

Also in FoxTalk is "With Aplomb" in 04/2001 from J Randy Person wich handles problems related to WITH ... ENDWITH.

Anyway, I still did'nt understand the use of "SET DATASESSION TO THISFORM.DATASESSIONID" in Destroy. In may understanding Datasession changes anyway if you call an other form's methods.
So normaly THISFORM.DATASESSIONID is always the active datasession if THISFORM..DATASESSION=2

If THISFORM..DATASESSION=1 than the datasession is used where form was created. But it is always actual in methods.

Use of "SET DATASESSION TO Not_ThisForms_Id" will cause horrible damage to THISFORMS Object CONTROLSOURCEs.
I use this command for an errorlog only.

Can you show me wich code causes the error ?

But wait, may be my english is not the best. Do I understand you call LOOKUP Form from form2 UNLOAD?

Have you checked the call stack in form1.cmdButtons second click, so that there is no crosswise calling and you stuck in form2.UNLOAD?


So you control form2 from form1. Maybe we do a workaround.

What about the following
Add a propety to form1 letsay goInput, defaultvalue = .NULL. and a property to form2 goParent defaultvalue .null..

In form1.release add
IF VARTYPE(THIS.goInput)='O' AND !ISNULL(THIS.goInput) THEN
 *whatever you do to Cleanup Form2
 THIS.goInput.RELEASE()
 THIS.goInput = .NULL.	&%not necessary
ENDIF VARTYPE(THIS.goInput)='O' ...
form.cmdButton.Click:
IF !VARTYPE(THISFORM.goInput)='O' OR ISNULL(THISFORM.goInput) THEN
 THISFORM.goInput = CREATEOBJECT('FORM2')
  THISFORM.goInput.goParent = THISFORM
ENDIF !VARTYPE(THISFORM.goInput)='O' ...
THISFORM.HIDE()
*...
THISFORM.goInputSHOW()
Do not cleanup and destroy form2 after finishing input. I guess you use a kind of close button
IF VARTYPE(THISFORM.goParent)='O' AND !ISNULL(THIS.goParent) THEN
 THISFORM.goParent.SHOW()
 THISFORM.HIDE()
ELSE
 *cleanup and release form
ENDIF VARTYPE(THISFORM.goParent)='O' ...
So final release of form1 will cleanup both forms, an reuse of input form will speed up.

Lutz
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform