Hi,
I use the same form over and over again in an MDI environment to display different sets of data.
For example, a user might open 3 different invoices simultaneously - the same invoice form, with a private datasession, opened 3 times.
Also, each instance of the form is given a unique name in its Init() - InvoiceForm1, InvoiceForm2, etc.
I am at the stage now of trying to get my login screen to work and this form, like all forms in the system, is automatically renamed to Loginform1 in its Init().
This causes a severe problem - FiC has created Loginform_ini.dbf and this no longer matches the name of the form and this produces an error.
Does FiC have a way of handling forms being renamed? Or handling the same form being reused many times simultaneously by the same user?
Thanks
Paul
Hi Paul,
What error do you see? Where? When?
What is the purpose of this form renaming?
Where in form.init()
code do you assign its new name?
What name does FoxInCloud assign to your form?
PS: again, please post code and error details; code and messages are much more meaningful to us than any description
Hi,
The error is :
Sficprocess.wformstandardpage() - Sficprocess.wform() - awserver.fxp!Awajax.lsuccess() - awajax.lSuccess(.f.): Error detected at code line #12,337 of method 'awajax.propsrestore'
"Properties table 'C:\work_FoxInCloud\4manufacturing-FoxInCloud\Temp\loginform1_Ini.DBF' cannot be found"
C:\work_FoxInCloud\4manufacturing-FoxInCloud\Temp\loginform1_Ini.DBF
(btw, this error is irrecoverable, attempting to stop WC causes VFP to have a Windows appcrash (I have to end the VFP task instead).
The code itself simply calculates the next number to assign to the form's name, based on the number of other instances of the form class already running.
So, to paraphrase :
if m.this.wlInitFirst or !m.this.wlWeb
DoDefault()
endif
if m.this.wlInitFirst
return
endif
...
thisform.name = thisform.name + alltrim(str(MaxWindowNumber))
e.g. if this is the third invoice form being opened simultaneously, it will be renamed to "invoiceform3"
This code is being executed in the Init() further up the form's class hierarchy in a base class (now a subclass of awFrm), so perhaps if I change the order in which the aw/FiC Init() code runs in relation to my own Init() code then it might work, i.e. move around a dodefault somewhere to make my code run before the FiC code.
What is the purpose? I suppose to uniquely identify the instance of the form to other objects which need to know, but they don't want to maintain a reference to the form object itself; I'm not actually sure, it is very old code.
Anyway, I guess it makes no sense in a web environment, so I will make the code "lan only" and see how it goes.
Thanks
Paul
If this renaming must follow your naming convention, you'll have to implement xxxFrm.Name_Assign()
somehow and we'll need an evolution in FoxInCloud.
If the important matter is the form being renamed, regardless of the new name, you can rely on FoxInCloud's renaming which takes into account multiple instances. Your code will become:
if m.this.wlInitFirst; && Form is first initialised in Web mode
or !m.this.wlWeb && Form is initialised in desktop mode
thisform.name = thisform.name + alltrim(str(MaxWindowNumber)) && In web mode, FoxInCloud will override this name
DoDefault()
endif
if m.this.wlInitFirst
return
endif
...