PUBLIC oform1 oform1=NEWOBJECT("form1") oform1.Show DEFINE CLASS form1 AS form DataSession = 2 DoCreate = .T. Caption = "Form1" Name = "Form1" ADD OBJECT command1 AS commandbutton WITH ; Top = 12, ; Left = 12, ; Height = 27, ; Width = 84, ; Caption = "Form win", ; Name = "Command1" ADD OBJECT container1 AS container WITH ; Top = 60, ; Left = 12, ; Width = 156, ; Height = 84, ; Name = "Container1" ADD OBJECT command2 AS commandbutton WITH ; Top = 12, ; Left = 180, ; Height = 27, ; Width = 84, ; Caption = "Session win", ; Enabled = .F., ; Name = "Command2" ADD OBJECT container2 AS container WITH ; Top = 60, ; Left = 180, ; Width = 156, ; Height = 84, ; Name = "Container2" PROCEDURE command1.Click MESSAGEBOX("form.datasession"+STR(thisform.DataSessionId)) * whit addobject the session doesn't create a new datasession THISFORM.Container1.AddObject("osession","Session") MESSAGEBOX("form.datasession"+STR(thisform.DataSessionId); + CHR(13) + "Container1.osession.datasession"+STR(THISFORM.Container1.osession.DataSessionId)) thisform.Command2.Enabled = .T. ENDPROC PROCEDURE command2.Click MESSAGEBOX("before form.datasession"+STR(thisform.DataSessionId)) formDatasession = thisform.DataSessionId WITH CREATEOBJECT("Session") SET DATASESSION TO .DataSessionId MESSAGEBOX("after form.datasession"+STR(thisform.DataSessionId); + CHR(13) + "Container1.osession.datasession"+STR(THISFORM.Container1.osession.DataSessionId)) ASESSIONS(ass) MESSAGEBOX("exists the before form.datasession ? "+TRANSFORM(not EMPTY(ASCAN(ass,thisform.DataSessionId)))) ENDWITH ENDPROC ENDDEFINE * *-- EndDefine: form1 **************************************************the VFP is a structural design, it is not a Form's design
WITH CREATEOBJECT("session") SET DATASESSION TO .DatasessionId NEWOBJECT("Container1") ENDWITH DEFINE CLASS Container1 AS Container DataSessionId = NULL PROCEDURE init MESSAGEBOX("container.datasession"+STR(this.DataSessionId)) THIS.AddObject("osession","Session") MESSAGEBOX("container.datasession"+STR(this.DataSessionId); + CHR(13) + "container.osession.datasession"+STR(THIS.osession.DataSessionId)) * now change the container datasession WITH CREATEOBJECT("Session") SET DATASESSION TO .DataSessionId MESSAGEBOX("container.datasession"+STR(this.DataSessionId); + CHR(13) + "container.osession.datasession"+STR(THIS.osession.DataSessionId)) ENDWITH ENDPROC PROCEDURE DataSessionId_Access RETURN SET("Datasession") ENDPROC ENDDEFINE>Or may be there is a way to temporarily unbind all controls?