Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Calling same form class on '3rd level' does not work wel
Message
From
12/02/2011 09:34:39
 
 
To
12/02/2011 08:52:00
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MySQL
Application:
Desktop
Miscellaneous
Thread ID:
01499848
Message ID:
01499887
Views:
69
>>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.
>
>To be honest, I'm not sure why you're able to set WindowType in Init the first time. Normally, when you call a form with DO FORM, you can't change WindowType. In order to be able to set WindowType, you need to call the form as a class, and then Show it, passing the WindowType parameter. However, I just did a test and was surprised to find that setting WindowType in Init worked.
>
>Have you tried tracing the code to see exactly what's happening in the second call to frmBrowser?
>
>Tamar


> >To be honest, I'm not sure why you're able to set WindowType in Init the first time. Normally, when you call a form with DO FORM, you can't change WindowType.

Tamar,

You can set the WIndowType in the init of the form. Been doing this for years.
Gregory
Previous
Reply
Map
View

Click here to load this message in the networking platform