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

Working with the modal form

Status
Not open for further replies.

jerold

Programmer
Aug 30, 2000
52
PH
I have this form1 which contains command buttons. One of the buttons click.method contains this code
do form form2
The problem is how to make the form2 load/show as modal(its nstyle is set to 1).
I wanted it to be this way so as to force the user
close the form2 before editing the form1.

Please help me.Thank you!
 
:)
THere are no 'set windowtype" command in VFP, as far as I know. Use following lines:

PUBLIC goMyFormVariable
DO FORM form2 NAME goMyFormVariable NOSHOW
&& check that it is really initialized
IF vartype(goMyFormVariable)=="O" AND !IsNull(goMyFormVariable)
goMyFormVariable.SHOW(1) && 1 - modal, 2 - modeless
ENDIF
release goMyFormVariable

 
Thanks for the code.
I tried it but there is an error;
command contains unrecognized keyword/phrase

The error lies on the IF..statement
Please assist me what does the vartype means..
 
Thanks for the code.
I tried it but there is an error;
command contains unrecognized keyword/phrase

The error lies on the IF..statement
Please assist me what does the vartype means..
is it a program or function
 
You may skip If statement. Vartype function comes in new versions of VFP. You may also change it to following:
IF type('goMyFormVariable')=="O" AND !IsNull(goMyFormVariable)
 
try the following code below in the load event of the
form for which u want to make it modal window.

thisform.show(1)

This single line will solve the problem.

The destined modal form should have proper exit code other
wise the form will hang.

Bye
Phani
 
Hi Jerold,

Try setting the following properties to your form2 :

AlwaysOnTop = .T.
ShowWindow = 1 - In Top Level Form
WindowState = 0 - Normal
WindowType = 1 - Modal

Hopes this helps

Yue Jeen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top