FoxInCloud
Recursive class def of xxsets
Gravatar is a globally recognized avatar based on your email address. Recursive class def of xxsets
  Lennert Blom
  All
  Sep 2, 2021 @ 08:01am

I have an extremely simple project (create a form with a button on it), just to try out FiC. I changed not a single line of code after publishing. I run the Web App studio and it tells me after I enter on "do abtest.prg":

Starting Web Application 'FoxInCloud App' in trial mode

Setting Application Environment… Instantiating class 'abSets' of 'C:\Test\Users\lenne\Documents\FoxInCloud\absets.fxp' into property 'oAppSets' of 'Awapphost'… Could not setup Application environment: Application environment class 'abSets' could not be instantiated.: 'Method or procedure init_app_(): error #1950 ("Class definition ABSETS is recursive") at code line #1,035 (source code N/A)'. Application environment class 'abSets' could not be instantiated.: 'Method or procedure init_app_(): error #1950 ("Class definition ABSETS is recursive") at code line #1,035 (source code N/A)' Application could not start: "Method or procedure init_app_(): error #1950 ("Class definition ABSETS is recursive") at code line #1,035 (source code N/A)"

I do not have the slightest idea. Class def absets in my opinion is not defined recursive, when I look at the code.

Any clues?

Code of absets.prg is below:

* =====================================================
DEFINE CLASS abSets as awSets of awPublic.prg && Added by FoxInCloud Adaptation Assistant version 2.31 (copy mode) on 09-02-2021 16:13
* =====================================================

&& This class is the standard implementation of application environment setting code.
&& FoxInCloud RECOMMENDS using a class as its .Destroy() method restores
&& the development environment, thus respect each developer's preferred settings.
&& If you prefer a procedural implementations, see down this file for more details.
&& If you prefer a procedural implementations, see down this file for more details.

&& To start your test FoxInCloud server, type in your Command Window:

* do <path to>abTest

* ---------------------
PROCEDURE Init
lparameters ;
result; && @ result of application startup - appears in .../foxincloud-status.xxx, and in server log if !m.success
, toAppHost as awAppHost of awAppHost.fxp && Application Host object (Web mode only)

* toAppHost gives you access to:
* - any PROTECTED property you've added to your server class - see class abServer in abServer.prg
* - you application's configuration object in m.toAppHost.oConfigApp - see class abAppConfig in abServer.prg
* - many other properties and methods that you can discover by setting a break point and typing 'm.toAppHost.' to trigger intellisense

local success as Boolean

success = DoDefault(@m.result) && IMPORTANT! sets the properties below
if !m.success
return .f.
endif

* HINT: In your code, you may take advantage of the following properties:
#if .F. && documentation
this.wlWeb && application runs in Web mode
this.wlLAN && (this.wlLAN = !this.wlWeb) application runs in LAN (desktop) mode
this.lDevMode && application runs in the IDE
this.lAutomation && App works in COM mode (this.wlWeb only)
#endif

* PLEASE NOTE
* --------------------------------------------------------------------------------------------
* FoxInCloud Adaptation Assistant has recycled the following code from
* 'C:\Test\Users\lenne\Documents\FoxInCloud\mystart.prg'.
* This code has the main configuration features for your application.
* You probably need to review it to operate correctly in Web mode,
* especially regarding the PATHes and tests specific to LAN mode.
* Note: the awPublic.prg!wlWeb() function indicates if application runs in Web mode.
* --------------------------------------------------------------------------------------------
* If you perform a new installation after some manual modifications,
* FoxInCloud Adaptation Assistant will detect it and propose to check
* and/or save the file before eventually replace it
* --------------------------------------------------------------------------------------------

* If anything serious happens during class initialization, set:
* success = .F.
* result = [the reason(s) why environment could not be set and/or application should not start]
* in Web mode, this error will get written into the application log, and a mail sent to administrator.
* in LAN mode, you could do something similar

* Before this code executes, FoxInCloud Application Server has set CurDir() to
* the application's main folder, where project resides
* (C:\Test\Users\lenne\Documents\FoxInCloud\)
* All the following pathes are relative to this folder …

SET PATH TO "..\" ADDITIVE

IF !this.lAutomation && In COM automation mode, Visual FoxPro implicitly performs a SET PROCEDURE and a SET CLASSLIB to the entire server by default when you instantiate an .exe or .dll COM server - if you reissue SET PROC or SET CLASSLIB repeatedly, COM object performance will drop sharply

SET PROCEDURE TO mystart ADDITIVE

ClassLibAdd("myclasses.vcx,ab.vcx") && modify command abDev
EXTERNAL PROCEDURE ClassLibAdd

ENDIF

&& Added by FoxInCloud Adaptation Assistant version 2.31 (copy mode) on 09-02-2021 15:57
*-FIC-  (see above) SET PATH TO (Home(1) + 'Tools\' + 'AB\') ADDITIVE
*-FIC-  (see above) AB() && loads FoxInCloud public modules located in the above folder, and shared on GitHub: https://github.com/FoxInCloud/FoxInCloud-AB.git
*-FIC-  (see above) SET CLASSLIB TO (Addbs(JustPath(Sys(16))) + 'AB.VCX') ADDITIVE && ab.vcx derives from aw.vcx
&& Added by FoxInCloud Adaptation Assistant version 2.31 (copy mode) on 09-02-2021 15:57

&& /!\ Please make sure that after this line:
&& - all your SET PATH/LIBRary/CLASslib/PROCedure have the ADDITIVE clause
&& - you have no CLOSE * or CLEAR ALL; or you move them before the above added code
&& Thanks

*-FIC-  (see above) SET CLASSLIB TO myClasses ADDITIVE
loform = CREATEOBJECT("myForm")
loform.visible = .t.
loform.addobject("Label1","myLabel")
loForm.Label1.Caption="Hallo"
loForm.Label1.Visible=.T.
loform.addobject("Close","myClose")
loForm.Close.Visible=.T.

return m.success && application won't start if .F.
endproc

* ---------------------
PROCEDURE Destroy

* add here [or move from this.init()]
* the instructions you need to execute when application unloads,
* such as garbage collection and/or RemoveProperty(_Screen, ...)

return DoDefault()
* You don't need to restore Set("Path"), Set("Procedure") and Set("Classlib")
* as DoDefault() does this automatically.
endproc

* =====================================================
ENDDEFINE && CLASS abSets && Added by FoxInCloud Adaptation Assistant version 2.31 (copy mode) on 09-02-2021 16:13
* =====================================================

&& This is a sample program for SETting application's environment
&& Ideally your application's LAN (desktop) and WEB versions SHARE this module
&& You may use either of these three implementations (see properties in abServer.prg):

&& Implementation              .cAppSetsLib    .cAppSets     .lAppSetsClass
&& ---------------------       -------------   ----------    ---------------
&& 1-Instantiate 'abSets'     'abSets.prg'   'abSets'     .T.
&& 2-Execute this program      'abSets.prg'   ''            .F.
&& 3-Execute 'abSets' proc    'abSets.prg'   'abSets'     .F.

&& Notes:
&& - In Web mode, as usually in LAN/desktop mode, when this module executes,
&& Curdir() is main program's folder where the project sits: '..\' in this case
&& - As FoxInCloud executes application in a Session class,
&& dataSession-dependant SETtings don't need be restored

Gravatar is a globally recognized avatar based on your email address. re: Recursive class def of xxsets
  FoxInCloud Support - Thierry N.
  Lennert Blom
  Sep 2, 2021 @ 10:14am

bad luck, 'ab' is the prefix for the first layer of FoxInCloud (underneath 'aw'), please choose another xxx prefix, preferably with 3 letters.

we've already excluded the prefixes listed below, we'll make sure to also exclude 'ab', 'ac' and 'at'

	, 'aw';
	, 'wc'; && wc.wc pour les opérations d'administration
	, 'ww';
	, 'txt';
	, 'htm';
	, 'html';
	, 'css';
	, 'js';
	, 'png';
	, 'gif';
	, 'jpg';
	, 'pdf';
	, 'doc';
	, 'ttf';
	, 'xls';
	, 'woff';
	, 'eot';
	, 'svg';
	, 'tas'; && tastrader sample
	, 'ftt'; && tastrader sample
	, 'scx'; && awAJAX.Navigate()
	, 'xxx';
	, 'xxx';

Cloud';

Gravatar is a globally recognized avatar based on your email address. re: Recursive class def of xxsets
  FoxInCloud Support - Thierry N.
  Lennert Blom
  Sep 3, 2021 @ 01:08am

To resume adaptation, please erase the <*adapt*> values in *awAdapter*.xml

Gravatar is a globally recognized avatar based on your email address. re: Recursive class def of xxsets
  Lennert Blom
  FoxInCloud Support - Thierry N.
  Sep 13, 2021 @ 12:51am

I just deleted everything to get rid of my "AB"-prefix, and chose a different prefix (lbp). I now get a different error:

My original complete code is quite simple, and still functions when called directly after adaptation:

SET CLASSLIB TO myClasses ADDITIVE
loform = CREATEOBJECT("myForm")
loform.visible = .t.
loform.addobject("Label1","myLabel")
loForm.Label1.Caption="Hallo"
loForm.Label1.Visible=.T.
loform.addobject("Close","myClose")
loForm.Close.Visible=.T.
READ EVENTS
CLEAR EVENTS
RELEASE loForm

myclasses is just a library where Form, Label, and Button are subclassed with no extra code except that the Button closes the form it is placed on when clicked on.

Anyone have a clue?

TIA,

Lennert

Gravatar is a globally recognized avatar based on your email address. re: Recursive class def of xxsets
  FoxInCloud Support - Thierry N.
  Lennert Blom
  Sep 14, 2021 @ 02:13am

Hi Lennert,

1- Thanks for raising this issue that we'll fix in a next release; until then you can use this workaround:

modify command lpbTest.prg
…
AW()
cLangUser('en') && add this line
…

2- FoxInCloud is more designed to address OOP, encapsulated classes and forms; eg. your form class should be self contained, holding all the necessary code and definitions to add whatever member it needs at runtime.

Please take some time to review the 'tastrader' sample, accessible through the FoxInCloud menu pad.

Feel free to ask any question that may help you better see the big picture.

© 1996-2024