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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

modeless forms and read events

Status
Not open for further replies.

diem

Programmer
Jul 25, 2001
28
US
Hi everyone,

I'm trying to make 2 or more modeless forms and switching between these forms. If I have a program like this:
****************************
...
...
do mainmenu && this is modeless form

read events

clear
close all

return
****************************
On the "mainmenu" form, I have Exit button that "clear events". The problem is I need to have 2 or more modeless forms to do some other tasks form "mainmenu" buttons. I cannot stop the program at some point to do some other things. It just goes on and execute the next line in the program. I need to be able to make change on the modeless form first and then click return to close it. How do I use the "read events" command for this problem?

Thank you in advance.
 
diem

It would ultimately be better for you if you renamed your main form 'mainform', rather than 'mainmenu'.

If you introduce a menu to the application, calling a form with the name 'menu' within will cause confusion.

In the 'Exit' button .click() event put:-

THISFORM.Release()

In the .Destroy() event of the form put:-

CLEAR EVENTS

If you want to call another form from a form use:-

DO FORM MysecondForm NAME oSecondForm LINKED

Your code does not show you calling a main form but executing a .prg, so try the following:-

...
...
DO FORM mainform NAME oMainform LINKED
read events

clear
close all

Modal or modeless is not an issue here - you need to get the forms interacting correctly first

HTH

Chris :)
 
Hi everyone,

Chris, I tried your tip, but I couldn't get the forms interacting correctly. I found a threat that one of the programmer asked and it's similar to my question. Here's the threat and one response to that question:

*****************************
upstatenewyorker (Programmer) Apr 19, 2001
I have a command button on a form. When the user clicks the command button, I want it to open another form, on this other form, I want them to make choice (click one of two option buttons), click "Submit" and return to the prior form and continue processing. The problem is, it'll open the other form but continue processing the code after

do form (form name)

How do I make it go to the other form and wait until they click submit to continue processing the code after do form (form name)????

***********************************
fluteplr (Programmer) Apr 19, 2001
have the second form be modal, is one way to do this. You can change the 2nd form to modal in the init of the second form. I often have the same form act both modally and non modally depending on whether a parameter was passed into it.

another way is to put a do while loop in the first form right after calling the 2nd form that waits for some condition to be set by the 2nd form. This can chew up a lot of cpu cycles and is a bit more tricky than the modal solution

*******************************

My problem is : I need to make both the other form and its prior form to be modeless so that the users can see the data on both of these forms at the same time. They can switch between these 2 forms.
Do you have any other idea to make it work? Any idea will help a lot. Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top