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

Can't call a form in a class 2

Status
Not open for further replies.

Gameboy9

Programmer
Jun 8, 2001
39
0
0
US
OK, I'm probably having a duh moment...

I know I can do a:

DO FORM vipervendsel WITH ThisForm.pgfrmPO.pgGenrlInfo.c.txtVendor.value, "C", thisform.pgfrmPO.pgGenrlInfo.c.cboOffice.Value TO lcVendor

But I want this particular form in a class seeing that it's being used by more than one program now... but how do I exactly call it? (three parameters, one variable to return) Can't do it by the DO FORM method when a form is in a class. :(

Thanks in advance.
 
set classlib to yourclassname
loForm = CREATEOBJECT('formname')
loForm.SHOW

Look in the FAQ sections. There are several examples of people doing this, only they are building the form based off of VFP form class. Same concept.



Jim Osieczonek
Delta Business Group, LLC
 
Gameboy9

Put the parameters in the same event in the class (the init) and call your form this way:
oForm = newobject("myForm","myclass")
oForm.show()


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Thanks for your replies. It works..... sort of.

The form appears, then immediatly vanishes. After this event I'm working with completes execution, for some weird reason, the destroy method gets called.

I also want the code to stop after I do the loForm.show() because I want the tlvendorselect class to return a variable before continuing.

Here's what I'm working with for this event:

loForm = NEWOBJECT("tlvendorselect", "common", "", ;
ThisForm.pgfrmPO.pgGenrlInfo.c.txtVendor.value, ;
thisform.pgfrmPO.pgGenrlInfo.c.cboOffice.Value, "C")
loForm.show()
* get vendor info if a vendor was selected.
IF NOT EMPTY(loForm.finalvendor)
ThisForm.pgfrmPO.pgGenrlInfo.c.txtVendor.Value = lcVendor
thisform.ischanged = .t.

thisform.lastvendor = ""
thisform.getvendorinfo
ENDIF

Is that enough code or do you need more information? Thanks again for any help you have.
 
create a property on the _screen object and set that property from within the class...as far as making program execution stop - make your form class modal.

Just a side-note: This thread is off-topic for this thread and should have been posted in Microsoft: VFP - Forms, Classes and Controls Forum forum1254. Posting off-topic can cause a thread to get deleted just so you are aware.

boyd.gif

[sub]craig1442@mchsi.com[/sub][sup]
"Whom computers would destroy, they must first drive mad." - Anon​
[/sup]
 
GameBoy9

The form appears, then immediatly vanishes. After this event I'm working with completes execution, for some weird reason, the destroy method gets called.

try :
oForm = newobject("myForm","myclass")
oForm.show(1)


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike: thanks for the oForm.show(1)

Craig: Thanks for the _screen suggestion... that worked too. And yes - I'm in the wrong forum - my bad. I'll try to get it right next time.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top