Hi,
thisform.wlInitFirst tells us if this is the first time the form has ever been initialised.
How can I know if this is first time the form's Init() has been run when a particular user "opens" the form and not when subsequent server requests by the user are made to it?
To give a contrived example :
I want to position the form at the bottom of the screen/page when Bob "opens" it, but not every time he does something that triggers a server request (and another call to form.Init() ). Same thing when Alice "opens" the form in her browser.
Thanks
Paul
form.Init()
executes:
- once when form gets first instantiated (
.wlInitFirst
), WITHOUT A USER CONTEXT, and without parameters >> from this state FoxInCloud generates HTML/CSS/JS and stores the form state inTemp\form_Init.dbf
; at this stage, to have the initial HTML without data, it's better to have views and cursorsnodata
and tables oneof()
if they enter in some.controlSource
- each time a user executes
[.]wForm*()
, with the related user context and parameters, then you requery the views and cursors, and/or setrecno()
on aliases.
For your contrived example:
- supported in classic mode only; in Bootstrap responsive mode, Bootstrap positions the 'dialogs'
- FoxInCloud natively supports
form.Move()
andform.resize()
(based on.Anchor
), stores position and dimension across user's sessions (recycles when user opens a new session), restores form's position and dimensions next time user opens it.
demo: http://foxincloud.com/tutotest/, open form as child form using the buttons and move it around, and/or resize, close it, re-open it; video: https://youtu.be/TyDRFm2nKPs
Thanks.
My example was really about how to execute a piece of code the first time a user "opens" or navigates to a form and not every time the user makes a request to the form just because a Valid() fired or a button is clicked etc.
In other words, like the Init() would work in lan mode - but in web mode 😉
I suppose I could code my own flag in a form, that is set to true when the Init() is called in web mode and !this.wlInitFirst, but I'm wondering if FiC already has something like this.
Paul
form.Init()
runs once after .wForm*()
, NOT before other user requests.
So, except when .wlInitFirst
, form.Init()
runs the same in desktop and Web modes.
procedure form.Init
…
if thisForm.wlInitFirst
&& just instantiated, no user context
return
endif
…
&& the code after this point executes:
&& - in desktop mode
&& - in web mode for each user using this form
if thisForm.wlWeb
&& running in Web mode
endif
if thisForm.wlLAN
&& running in desktop mode
endif