Installation
--
Questions
--
Followers
Top Experts
If the end user determines the data in the grid needs to be edited I have a command button that will make form2 visible and show form2. The second form queries and inventory master and displays the results of a cursor into a combo box. During testing of the application within VFP everything works perfectly.
However I now am ready to distribute the application via a setup program using InstallSheild. Â During the init method of form1 I have the following command: application.visible = .f. to turn off the main Visual Fox Pro window. Â I have the form1.showwindow property set to a top level form and form2.showwindow property set to: in top level form, I also have form2.alwaysontop property set to .T. Â My problem is if I distribute the application and call form2 from form1 it is not visible...I do not get an error, I just can't see form2. Â However if modify form1.init event and set application.visible = .t. when I call form2 it loads but it loads behind form1 into my task bar and I have to click on the task bar to bring the form to the forefront.
My goal is to obviously set application.visible = .f. and be able to load form2 into the top level form1. Â What I am missing? Â Any help would be greatly appreciated.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
I have never used formsets. They are also not recommended. You could try setting AlwaysOnTop for form2 to .T.
If you want ShowWindow to work as you need then you need one Main form having ShowWindow property set to "As top level form" and all other forms which should be displayed inside this Main form must be initialized from this Main form by DO FORM command or created by CREATEOBJECT(). These "child" forms must have ShowWindow property set to "In top level form" and they don't need to be On top. If you would like to move these child forms outside the Main form, set its Desktop property to .T.
I am just not sure if it is possible to remove some form from the formset without its deletion. Probably not... So, you have to create a new form outside the formset, copy all controls and code from the form created in formset and then you may remove the form from formset...
BTW, I am also not using application.visible  but _screen.visible.
So, if you really need a formset having one Top level form and the second form In Top level form, create the second form by Formset's AddObject method:
THISFORMSET.AddObject('new
THISFORMSET.NewForm.Visibl
The class FormInTopLevelForm is your second form having ShowWindow property set to "In top level form".
The question is: Do you really need Formset? Sometimes it would be useful to have some container for app forms but I don't think it is necessary in many cases.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Thanks for the response. Â The reason I created a formset was because form2 in my scenario stores a value selected from a combo box to a variable when a command buttoned has been clicked. Â Also within the command button of form2 I have the following code
thisformset.form1.command7
thisformset.form1.command7
These commands allow me to update the grid on form1 using a cursor in the command7.click event with the value of the variable from form2.
I initially tried not using a formset but having 2 separate forms and in the command button of form2 I tried this code
form1.command7.setfocus( )
form1.command7.click
however when using separate forms...when I attempt to click the command button in question on form 2 it says "Object Form1 not found" Â ?? The forms are in the same project and in the same folder. Â The init event in form1 has a set default to 'c:\projectfolder'
Is there a way to accomplish this using separate forms or since I already have everthing coded for a formset should I try the thisformset.addobject you mentioned above?
Sorry for the delay I have been out of the office. Â I have removed the formset and now have two independent forms. Â I am having no luck with _screen.forms to find the object reference for form1. Â It allways tells me form not found. Â What is the exact syntax of that command? Â I must be missing something.
I would like to use your example:
DO FORM Form2 WITH THISFORM
Form2.Init:
LPARAMETER loCallingForm
*-- Some Init code
*-- Store the calling object reference
THISFORM.CallingFormRefere
*-- etc.
RETURN
When referencing Form1 use simple:
THISFORM.CallingFormRefere
THISFORM.CallingFormRefere
Thanks again for your help....you are definitely a FoxPro Guru
References to all instantiated forms are in the array
_screen.Forms[n]
number of forms is in
_screen.FormCount
The problematic part could be to find out the right form from above collection... So it is easier to use the parameter.
If you execute your code to display forms and then invoke debug command you may simply look at it.
Possible code to find the reference is here:
loFormRef = null
FOR lnI = 1 TO _screen.FormCount
IF _screen.Forms[lnI].Name = 'Form1' AND _screen.Forms[lnI].Caption = "< Form title here >"
loFormRef = _screen.Forms[lnI].
ENDIF
NEXT

Get a FREE t-shirt when you ask your first question.
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
DO FORM form2 WITH THISFORM
I thought I did exactly what you said
DO FORM Form2 WITH THISFORM
Form2.Init:
LPARAMETER loCallingForm
*-- Some Init code
*-- Store the calling object reference
THISFORM.CallingFormRefere
*-- etc.
RETURN
When referencing Form1 use simple:
THISFORM.CallingFormRefere
THISFORM.CallingFormRefere
I have stored the variable in the load property of the form.  However when I call form2 from form1 it says Parameter statement not found?  I am sorry if I seem like and idiot today....but I replaced an Oracle server last night for one of my clients and I am running on almost no sleep.  But I have to have this Foxpro project delivered by tomorrow and this is the only thing holding me up at this point...thanks again for  your help.
Thanks again. Â Disregard my last post. Â I forgot to add the new property to form2....as I mentioned I have not slept for over 40 hours. Once I added the custom property to the form your solution worked like a charm! Â Greatly appreciated.






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Installation
--
Questions
--
Followers
Top Experts
Installation is the act of making a computer program program ready for execution. Because the process varies programs often come with a specialized program responsible for doing whatever is needed for their installation. Installation may be part of a larger software deployment process. Cross platform installer builders that produce installers for Windows, Mac OS X and Linux include InstallAnywhere, InstallBuilder and Install4J. Installers for Microsoft Windows include Windows Installer, InstallShield, and Wise Installation Studio; free installer-authoring tools include NSIS, IzPack, Clickteam, InnoSetup, InstallSimple and WiX. Mac OS X includes Installer, and also includes a separate software updating application.