Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Instantiating Form class in INIT of another form
Message
From
11/07/2018 02:18:48
 
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
01661090
Message ID:
01661100
Views:
80
The pressing problem is already solved.
The approach of keeping helper forms set to invisible around is often more beneficial than creating and destoying helper forms on each access.
BUT:
As time to interactive is one of the most sought-after targets in mobile, doing such housekeeping in init() IMO is not best.

Better:
enhance calling methods to check and if not created create form in question, put it into property and keep it.
If you have 10 such helper forms, main form will be accessible on start much sooner, on first call of each helper form there is a minute lag never experienced again as form is kept in memory. If client loves big words, tell him that the app caches resources as demanded by user and liken that to Java hotspotting some methods during runtime ;-))

Even better:
create those helper forms via timer if user is inactive for a while. Fast main form start and first lag of helper screen often hidden.

Cherry on top:
make the order of the helper forms data-driven by the usage of each user, so that the blonde from car insurance gets all car helper screens cached first while the brunette from home insurance has other helper screens up earlier.




>Hi,
>
>I have a form that will have a few "lookup" forms that will be opened and hidden quite often. So, I prefer to instantiate these "lookup" forms in the INIT of the parent form. Here is how I tried it:
>
>
>*-- in the INIT method of the parent form
>thisform.NewObject( "LookupForm1", "LookupForm1", "MYLIB.VCX")
>
>
>The error I get is "Object class is invalid for this container"
>
>What am I doing wrong?
>
>TIA
>
>UPDATE: Decided to change the approach:
>Created property oLookupForm1 and then in the INIT of the parent form instantiate it as:
>
>thisform.oLookupForm1 = CREATEOBJECT( "LookupForm1" )
>
>Then, in Destroy method, set value to NULL.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform