Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Application Framework DoForm
Message
From
22/09/2005 08:50:14
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01051754
Message ID:
01051916
Views:
6
Here is a copy of the default code for _application.doform(). I don't have to use this call. I'm just confused about why I can't seem to get this to work. I just want to start the form ( the same way as I do many others in this application ) and just pass a parameter. But I need to keep the form within the _application so I can continue to utilize AFROMS obj, etc. that are integral parts of my application.

Thanks again.
LPARAMETERS tcFileName,tcClass,tlNoMultipleInstances,tlNoShow, tlGoMenu, tlNavToolbar

ASSERT EMPTY(tcFileName) OR VARTYPE(tcFileName) = "C"
ASSERT EMPTY(tcClass) OR VARTYPE(tcClass) = "C"

LOCAL lcFileName,lcClass,lnCount, lcFormName,lnFormCount, loMediator, ;
      loForm, loFormMember, lNeedReActivateFormset, ;
      llFormSet,llEnabledFormFound
*&* VFP 5 framework cascade code also used: 
*&* LOCAL lnTop,lnLeft,loForm2,lcName

THIS.ClearLastError()

lcFileName=ALLTRIM(tcFileName)

lcClass=IIF(VARTYPE(tcClass)="C",LOWER(ALLTRIM(tcClass)),"")

IF EMPTY(lcClass)
   lcFileName = THIS.GetResourceFileName(lcFileName,".scx")
ELSE
   lcFileName = THIS.GetResourceFileName(lcFileName,".vcx")
ENDIF   

IF EMPTY(lcFileName)
   RETURN .F.
ENDIF   

lcFormName=IIF(EMPTY(lcClass),lcFileName,lcFileName+","+lcClass)
IF tlNoMultipleInstances
   FOR lnCount = 1 TO THIS.nFormCount
      IF THIS.aFormNames[lnCount]==lcFormName AND ;
         VARTYPE(THIS.aForms[lnCount])="O" 
         IF UPPER(THIS.aForms[lnCount].BaseClass)== "FORM" AND ;
            THIS.aForms[lnCount].WindowState = 1 && minimized
            THIS.aForms[lnCount].WindowState = 0
         ENDIF
         IF VARTYPE(THIS.oFrame) = "O"
            THIS.oFrame.Show()
         ENDIF
         THIS.aForms[lnCount].Show
         RETURN .F.
      ENDIF
   ENDFOR
ENDIF

* this is a hook, nothing in it
IF NOT THIS.BeforeDoForm(tcFileName,tcClass,tlNoMultipleInstances,tlNoShow, tlGoMenu, tlNavToolbar)
   RETURN .F
ENDIF

THIS.RefreshFormsCollection
THIS.nFormCount=THIS.nFormCount+1
DIMENSION THIS.aForms[THIS.nFormCount],THIS.aFormNames[THIS.nFormCount]
THIS.aFormNames[THIS.nFormCount]=lcFormName

IF VARTYPE(THIS.oFrame) = "O"
   THIS.oFrame.Show()
ENDIF

IF NOT EMPTY(lcClass)
   THIS.aForms[THIS.nFormCount] = ;
        THIS.Instantiate(lcClass, lcFileName)
ELSE
   DO FORM (lcFileName) NAME THIS.aForms[THIS.nFormCount] LINKED NOSHOW
ENDIF

lnFormCount=THIS.nFormCount
THIS.RefreshFormsCollection

IF THIS.nFormCount>=lnFormCount
   * success so far, 
   * let's enable and position the new object(s)
   * and then show it/them if we're supposed to:
   
   loForm = THIS.aForms[THIS.nFormCount] 
   llFormSet = (UPPER(loForm.BaseClass) == "FORMSET")      
   
   IF llFormSet
  
      FOR EACH loFormMember IN loForm.Forms 
         IF UPPER(loFormMember.BaseClass) == "FORM" 
            * skip toolbars         
            loMediator = THIS.GetFormMediatorRef(loFormMember)
            * don't force until we know about all forms
            * in set; see note below
            IF VARTYPE(loMediator) = "O"
               loMediator.LoadApp(THIS.cReference)
               loMediator.lGoMenu = tlGoMenu
               loMediator.lNavToolbar = tlNavToolbar
               llEnabledFormFound = .T.
            ENDIF
            
         ENDIF
      ENDFOR         
   
   ELSE

      loMediator = THIS.GetFormMediatorRef(THIS.aForms[THIS.nFormCount], ;
                                           THIS.lEnableFormsAtRunTime)
      * second param will force creation
      * if lEnableFormsAtRuntime is on
      IF VARTYPE(loMediator) = "O"
         loMediator.LoadApp(THIS.cReference)
         loMediator.lGoMenu = tlGoMenu
         loMediator.lNavToolbar = tlNavToolbar
      ENDIF
   ENDIF
   
   * if any forms in the formset are enabled,
   * some may have been left un-enabled by
   * intent, so that they don't get icon or whatever.
   * So if even one form in the formset is enabled
   * we won't dynamically enable the rest.   That's
   * why the below FOR/ENDFOR has to be done separately
   * from the above attempt to load mediators in a formset:
   
   IF llFormSet AND ;
      (NOT llEnabledFormFound) AND ;
      THIS.lEnableFormsAtRunTime
      
      THIS.ClearLastError()

      FOR EACH loFormMember IN loForm.Forms 
         IF UPPER(loFormMember.BaseClass) == "FORM"
            loMediator = THIS.CreateFormMediator(loFormMember)
            IF VARTYPE(loMediator) = "O"
               loMediator.LoadApp(THIS.cReference)
               loMediator.lGoMenu = tlGoMenu
               loMediator.lNavToolbar = tlNavToolbar
            ENDIF
         ENDIF
      ENDFOR         
  
   ENDIF

   IF NOT tlNoShow
      IF VARTYPE(THIS.oFrame) # "O"
         IF llFormSet
            * there is something screwy about
            * formsets when some forms may be showwindow 0
            * and others 1, even in _SCREEN, so it's
            * best to show each form separately:
            FOR EACH loFormMember IN loForm.Forms
              loFormMember.Show()
            ENDFOR
         ELSE
            loForm.Show()
         ENDIF
      ELSE
         * seems as though if even one form in
         * the formset is ShowWindow = 0,
         * then all forms must be brought into the top form
         IF llFormSet
            FOR EACH loFormMember IN loForm.Forms
               IF loFormMember.ShowWindow = 0
                 lNeedReActivateFormset = .T.
                 EXIT
               ENDIF
            ENDFOR
            FOR EACH loFormMember IN loForm.Forms
               IF lNeedReActivateFormset
                  THIS.ActivateFormInFrame(loFormMember)
               ELSE
                  loFormMember.Show()         
               ENDIF
            ENDFOR
         ELSE
            IF loForm.ShowWindow = 0
               THIS.ActivateFormInFrame(loForm)
            ELSE
               loForm.Show()
            ENDIF
         ENDIF
      ENDIF
   ENDIF
   
   IF THIS.lCascadeForms AND NOT llFormSet
      THIS.CascadeAll(loForm.Name)
      *&* this is where VFP framework used THIS.nPixelOffset,
      *&* all that code removed but the property might still
      *&* be useful somewhere
   ENDIF      
  
ENDIF

RETURN (THIS.IsErrorFree())
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform