Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forms Releasing when first called. 1

Status
Not open for further replies.

jpstafford

Technical User
Nov 13, 2000
19
0
0
US
I am converting screens from 2.6a to Visual. If I let foxPro do a functional convertion everything works ok but the code is ugly so I am conveting everthing dirrectly to Visual. Here's my problem:
The forms default window type is 'Modeless' which means to me that I could operate on multiple screens. These forms only flash on the screen then closes. When I change the window type to 'Modal' the screen will stay visable and the users can to there thing, except sometimes the first time the form is initialized it acts like the Modeless forms and closes. The next time the form will stay initialized.
What am I doing wrong or haven't set in these forms. There isn't any ReadDeactivate method in these types of form that I could set to False until I release the Form. Help!!
 
jpstafford

It sounds as though your application lacks

READ EVENTS

and

CLEAR EVENTS

I suggest you do a keyword search on both commands as this question has been covered in depth before.

As a starter try thread184-24450

Chris
 
I use a Read Events in place of my old Read Cycle Act() Deact() statement. All my application systems are started with a Menu, Logo, and Read Events. No Databases Open. The user can then call one of many Forms in the System i.e. Equipment Tracking System. I was under the impressin that you could only have ONE READ EVENTS and then all the forms that are called feeds off of this one READ EVENTS. Does the read vents have to be reinitialize for every new form called, I'm confused?
 
Hi Jpstafford,
Do you launch your form from prg? I guess there is form.release somewhere in your prg.

If your form is VFP manner-ed, there is no need to have
READ EVENTS at all. READ EVENTS is used inside menu loop.

Pls tell us where do you invoke the forms ?

Jimmy




 
jpstafford

The conventional way in Visual FoxPro is to have a MAIN.prg, which firstly sets up the environment, opening databases, tables, (depending on size, numbers, etc), initialising any global variables, calls your menu, etc, and then calls a mainform.

* MAIN.prg
* setup code

DO MAINMENU.mpr && Main menu
DO FORM MAINFORM NAME oMainForm LINKED
READ EVENTS

* Cleanup code
QUIT
* EOF

In th Destroy event of mainform put:-

CLEAR EVENTS

This enables the application to execute the cleanup code following READ EVENTS in main.prg and QUIT

You can then call all other forms from mainform without any further READ EVENTS, and in this simple example, you need to exit the application by closing mainform.

So what is missing from your application, assuming you want to follow this convention, is a main.prg, which also would contain any generic procedures and functions which are not suited to be form methods.

Hope this helps

Chris
 
Thanks Guys for the responces. Yes I do follow standard practices and have a .Prg main program called Start.prg. I set up the enviroment (Main Menu, Gobal Variables, Privileges, Network Enviroment etc. Its not much different form the 2.6a Start.prg execpt using the Read Events in place of the Foundation Read. All forms are called forms the Main Menu.

[Start Code]
* User logs on first then the basic stuff
* Enviroment Stuff
DO Logo.prg
DO basic.mpr
READ EVENTS
* Log Off and Clean Up stuff
[End Code]

There isn't any main form. I guess this could be my logo form instead of logo program. I don't see what a active form does for me when the only thing I need at this time is a wait statement (Waiting for the user to choice from Many Options).

I am also wondering if some of my problems may be VFP3.0. I am upgrading at this time to Visual FoxPro 6.0. At this time I haven't done much in 6.o but it seems to be much more stable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top