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

How do you get a form to display that has been saved as a class 1

Status
Not open for further replies.

jrumbaug

Programmer
Apr 27, 2003
90
US
I am using FVP8. I am visually creating my second user defined class. It is a form.

I can create the object with :
oForm = CreatObject('MyForm')

I can add values to it with:
oForm.MyItems.value = "MyInfo"

But I can't figure out how to make the form appear. It has NOT worked to say:
DO FORM oForm

Thanks in advance

Jim Rumbaugh
 
try

Code:
 oForm = [blue]CreatObject[/blue]('MyForm')
oForm.[blue]show[/blue](1)  [green]&& Or 0[/green]

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Jim,

in fact every visual class is created invisible by CreateObject(), disregarding the .Visible Property set in the class. This is done to be able to change some properties regarding position and size etc. before showing the form,control etc.

In fact you could also show the form with oForm.visible=.t., but it's recommended to use the .Show()-Method of a form.

Bye, Olaf.
 
Olaf

As a follow up to your suggestion:

"In fact you could also show the form with oForm.visible=.t., "

Could the "form" be disabled with :
oForm.visible=.f.

and later recalled with :
oForm.visible=.t.

The point is I would not want a form that was invisible but capable of responding to user clicks. In the future I may have a need to suspend a form and then restore without re-creating the form and it's content.

Jim Rumbaugh
 
The point is I would not want a form that was invisible but capable of responding to user clicks. In the future I may have a need to suspend a form and then restore without re-creating the form and it's content.

[blue]Visible[/blue] = .f. does not mean if the user clicks around he may find it and click something by mistake, it means not visible as if it did not exist. [blue]Show()[/blue] and [blue]Hide()[/blue] will acheive the same.




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks Mike

My questions are answered

Jim Rumbaugh
 
To clarify a little further, a form that isn't visible can never have focus, so it can't receive UI events (mouse events or keystrokes), but it does exist. If it has a timer that is enabled, that timer can fire (causing stuff to happen), and after making a form visible, then invisible, the form can be recalled with myForm.Visible=.t. again. This technique can be used to create a particular form once, and make it visible very quickly each time you need the user to see (and use) it.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Thank you Bill.
I plan on trying to use the VISIBLE=.F. with a class form I am developing. It will be pop-up list class. I was wondering how people got a return value from a form object. I knew how to get a return from a form, but if the form was an object, not called like a form, I was not sure how to get the value returned. By setting VISIBLE=.F., I can return to the calling program and still read the VALUE of the list-form object, since I am not releasing the object imediatley after the selection from the list.

Thanks to everyone.

Jim Rumbaugh
 
Hi Jim,

I encountered the same trouble with returning a value from a form instantiated through CREATEOBJECT() or NEWOBJECT() ( I now use NEWOBJECT almost exclusively).

The way I did it was to have a property on my application object, FormResult, which any form which is closing could set, simply by "oApp.FormResult = whatever"... so as code that just created a modal form, and showed it through loModalForm.Show(1), could just check oApp.FormResult on the next line.

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top