Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling same form class on '3rd level' does not work well
Message
From
11/02/2011 22:03:11
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Calling same form class on '3rd level' does not work well
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MySQL
Application:
Desktop
Miscellaneous
Thread ID:
01499848
Message ID:
01499848
Views:
252
Dear Experts,

I have two form classes: frmBrowser and frmEntry.

Class frmBrowser is basically used as a UI to show user existing records of a table. Its uses:

1. It can be passed a "browse" or "search" mode. The only difference between the two modes is that "search" mode sets focus to a finder textbox and makes the form Modal.
2. Has buttons to allow user to Add, Edit, Delete. This will call instances of class frmEntry.

It has the ff Init code:
LPARAMETERS tcCAClass, tcCAClassLib, tcMode, toCallingForm

This.oCursor = NEWOBJECT( tcCAClass, tcCAClassLib )

WITH ThisForm

   .LoadData()     && calls oCursor.CursorFill()

   llLockScreen = .LockScreen
   .LockScreen = .F.
   
   IF PCOUNT() >= 4                                 && means this is used as Search Form
      .Mode = tcMode
      .oCallingForm = toCallingForm
      .oCallingForm.oReturnData = NULL   && assumes oReturnData is present
      .txtFind.SetFocus()
      .WindowType = 1 
   ENDIF
   
   .LoadUIControls()
   .ResizeForm() 
   .RefreshControls()

   .LockScreen = llLockScreen
   
ENDWITH
Class frmEntry is basically a data entry form which asks for a Mode parameter and PK value (for Edit and Delete modes). It is always in MODAL mode.

The typical scenario I want to happen is this:

1. User elects to browse Customers, my app calls frmBrowser (instantiated from class frmBrowser) and passes the CA of Customer table, its VCX, and a "browse" mode value.
2. frmBrowser comes up. Good.
3. User elects to add, edit or delete. frmBrowser calls frmCustomer to allow user. Good.
4. in frmCustomer, I have a button which calls frmBrowser, but this time is passed the CA of Salesman table, its VCX, then the "search" mode value, and a ThisForm reference. This is supposed to show frmBrowser containing Salesman records, and behaves as a search form.

Number 4 is where the problem arises, frmBrowser, which should show the Salesman table, just flashes!

The button which calls frmBrowser from frmCustomer has this code:
DO FORM frmBrowser WITH "mySalesmanCA", "myVCX", "SEARCH", ThisForm
So far, this is what I have noticed:

1. If I create a form, and a button in it to call frmBrowser with the needed parameters it works fine.
2. But if I have frmBrowser called, which calls frmEntry, which calls frmBrowser again (as a search form), the last one just flashes.

Been at it for a whole day with no success. I have also tried to make frmCustomer both as Modal and Non-Modal, with the same flashing result.

Thanks In Advance
Dennis
Next
Reply
Map
View

Click here to load this message in the networking platform