FoxInCloud
thisform.Load and dodefault()
Gravatar is a globally recognized avatar based on your email address. thisform.Load and dodefault()
  Paul
  All
  Jun 3, 2019 @ 10:34pm

Hi,

FiC requires that dodefault() be called at the end of a form's Load event, so that awfrm.Load can process the views etc.
However, I have traditionally called dodefault() at the beginning because my parent class executes set database to abc in its Load and the current database needs to be set before views are opened in the child's Load.

For the moment I have changed the pattern so that I call dodefault(.T.) at the beginning and dodefault(.F.) at the end and I use the parameter to either call the FiC code or not. Not very elegant perhaps, but I am looking for the easiest way to adapt existing code.
I don't use a form's DataEnvironment, but maybe I should so I can put the set database code in one of its events and then I only have to think about calling dodefault() in the Load just to call FiC code.

I am curious - what do FiC customers tend to do in this situation?

Thanks
Paul

Gravatar is a globally recognized avatar based on your email address. re: thisform.Load and dodefault()
  FoxInCloud Support - Thierry N.
  Paul
  Jun 4, 2019 @ 01:59am

what do FiC customers tend to do in this situation?

I see either solutions

those using form classes seldom use a dataEnvironment class (.DEclass and .DEclassLibrary) so they tend to set the dataEnvironment in their formBaseClass.Load() and use a logical parameter to call awFrm.Load() through dodefault(.T.) at the very end of their .Load() code.

also handy because the original dodefault() can stay the same and you can have this kind of construct:

procedure load
lparameter endOfLoad
if m.endOfLoad
  return dodefault(m.endOfLoad)
else
  <unchanged original code>
endif
return dodefault(.T.)
Gravatar is a globally recognized avatar based on your email address. re: thisform.Load and dodefault()
  Paul
  FoxInCloud Support - Thierry N.
  Jun 4, 2019 @ 02:28pm

That is helpful, thanks.

© 1996-2024