Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
When to use a formset?
Message
De
11/08/1999 22:23:32
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00252480
Message ID:
00252829
Vues:
9
>I am creating an app that uses 5 screens (forms). Typically
>in the past I would create individual forms and call them
>with "do form xxxxxxx". I am now wondering if a formset is
>a better way to work. Then I would change the "visible"
>property as I need a certain form displayed. The reason
>I don't think I like the "do form" method is that it
>seems that the data environment has to be set up for each
>form. With a formset I could do that once. I'm no expert
>so I would like some input.



Hi!
There are some different methods to do:

a) Do Form xxxx
Simply and show single form each time!
Since data is completed seperate, no need to take care DE side effect!

b) Do Form xxxx && Which is a Formset with mult-forms
As all Forms all loaded at beginning, you may need long time to start
the program everytime!
Need to take care DE Side effect #

c) ThisFormSet.AddObject("FrmCustomer1", "FrmCustomer" [, Init parameters...])
Load the Button Menu Form at begining, fast of cos.
Add needed form when needed!
Need to take care DE Side effect #
CreateObject() Init DE problem ##

Currently, I use method c)
Code for open new form in Formset will be like follows:
* FrmMenu.cmdCustomer.Click()
IF !PEMSTATUS(THISFORMSET, "FCUSTOMER1", 5)
	THISFORMSET.ADDOBJECT("FCUSTOMER1","FCUSTOMER")
ENDIF

THISFORMSET.FCUSTOMER1.VISIBLE = .T.
THISFORMSET.FCUSTOMER1.ZORDER(0)



Since you can't call Do Form to add new form to formset,
you need to Save the form as a Class in Class library!

Problem Occurs List:
# Common DE problem
Data cursor will go away according to DE relationship!

e.g. you Take a Orders "PO1234" ,
OrdItems will go to "PO1234" as wanted!!
But if you open the Item Form, you will find that
the Item cursor will go to "PO1234" Orditems First Item data..
as DE relationship call Item Cursor run away...

i.e. If you open the Item Form first to check somehow data,
after you Open the Orders Form to "PO1234" and you want to
back to Item Form.
Result: You find the Item is NOT to original record as
this side effect, and the user will complain that is not perfect on
Multi-Window!

To fix this, you need to set All Form section to 2.
Totally not shared! but somdays you may want to get that benefit on
DE side effect.. but change data section is dangerous suggestion!
-_- that was my question at here and got arguement.

## CreateObject() init DE problem
To use Form as Class, you can't use the DE as easy as form designer.
You need to create All the needed Cursor at Form.Load

IF !Used("MyTable")
Use MyTable Again in 0 Order tag myKey shared
ENDIF
Select MyTable
SET RELATION TO MyKey INTO MyChild ADDITIVE

Now, you need to take care on Grid, combox, listbox init problem!!!
This problem is more serious!
You can't assign the init recordsource, rowsource to those object for
Addobject nor CreateObject


It will Automatically fill in the Current Work Area
as recordsource, rowsource!! ~~>_<~~
If there is nothing on Current Work Area, it give a FileOpen dialog box
to ask for work area...

This problem waste me 2 weeks time to observe this bug...
So, you need to code Select CorrectCursor before object create...
And surely it will Ignore the recordsource, rowsource assignment at obj.Init

#_#; It made me angry as the program Ignore my coding!




To conclude, although my application success to work,
I still suggest you NOT to change it to Formset.
You may need to waste much time on handling some out of you expectation bugs!

If you really want to try, the above coding will surely quicken you starting!
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform