×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Form.Show() doesn't work in exe but works through prg

Form.Show() doesn't work in exe but works through prg

Form.Show() doesn't work in exe but works through prg

(OP)
Dear Team!

I have come across a weird situation and failed to reach at a solution so far.
I have a login form, being created from a class (it's a class which holds application level details),
using loForm = CREATEOBJECT('loginpicture'). But, when I call the Show method, using 'LoForm.Show()' to show the form and to wait for user input, it doesn't work. The login form is not shown and without any error it just flows to the next line after this. However, it works and form is shown with employee list from the development enviro, ie when I start the application from command prompt by calling its main prg file. I am not able to remember any change I made which might have caused this.

By the way, the form 'WindowType' is Model.

Now, I just want to know if this is a known issue that something which could prevent the form being shown through the 'Show' method.
If there isn't any clue, I want to dig deeper to solve this.

Thanks in advance.
Rajesh

RE: Form.Show() doesn't work in exe but works through prg

If the form is modal you should pass 1 in Show:

CODE

LoForm.Show(1) 

Borislav Borissov
VFP9 SP2, SQL Server

RE: Form.Show() doesn't work in exe but works through prg

WindowType 1 (Modal) does not work for ShowWindow=2 (as Top-Level Form). I guess you have set this so the login form shows as single form without _screen or another top-level form in the background.
Either you have a READ EVENTS or you use the _SCREEN and make this login form an "In-Screen" form or have your own "Top-Level" form and make the login form an "In Top-Level" form.
With READ EVENTS your login success has to be returned via something staying in scope, eg a _SCREEN property (_SCREEN always exists, even if you don't want to show it), public variable, private variable initiated before the form call, goApp application object property or anything else you can think of, then can CLEAR EVENTS and continue after READ EVENTS depending on login success, to eventually QUIT or start another READ EVENTS after the normal application main form started as Top-Level form.

Bye, Olaf.

RE: Form.Show() doesn't work in exe but works through prg

(OP)
Thanks for all answers.

Dear bborissov,
The form is already Modal and in Fox help, it is written that if we don't pass parameter in Show(), the WindowType will be assumed.
Also, I knew this was working earlier. Now, I am stuck up with what happened or may be what mistake I did!

Dear Olaf,
I just saw that the form ShowWindow is 0, ie In Screen.

Any other clue, please?

Rajesh

RE: Form.Show() doesn't work in exe but works through prg

Well, if it's in screen, do you show the screen? Can you check _SCREEN.visible? A config.fpw with SCREEN=OFF might hide it and then forms "In Screen" also are hidden.
And finally, when you DO main in somre.EXE you don't start a new process, the EXE isn't executed, you stay in the process and DO main.prg within the IDE, which has a visible _SCREEN, showing the form.

Bye, Olaf.

RE: Form.Show() doesn't work in exe but works through prg

Can you verify the class "loginpicture" you instanciate is at all a form? Does Messagebox(loForm.baseclass) display "form"?
You might have two classes named exactly the same and start something else.

Bye, Olaf.

RE: Form.Show() doesn't work in exe but works through prg

(OP)
Dear Olaf,

You DID it! You did catch the thief!!! I recall investigating methods of 'Sherlock Holmes' smile)...
I am impressed, really, the way you assumed where and what could be the issue even without a piece of code in hand, Great!!!

Thanks a lot to all others also for your valuable time.

Quote (Olaf)

Can you check _SCREEN.visible? A config.fpw with SCREEN=OFF might hide it and then forms "In Screen" also are hidden

Yes, the culprit was the 'config.fpw' which was created when I used a small program to programmatically create an EXE file from a PRG without using a project file. Unfortunately, I did that in the same folder where the subject project is kept (I shouldn't have done that sad ).

I am posting that small program also, it if benefits someone. I think, this is an edited version of a code I got from someone else, probably in this forum itself. However, here it goes.

CODE -->

PARAMETERS pPrg
IF TYPE('pPrg') <> 'C' OR EMPTY(pPrg)
	MESSAGEBOX('Pass proper prg name with full path')
	RETURN
ENDIF 
pPrg = FORCEEXT(pPrg,'prg')	
pExe = JUSTSTEM(pPrg)
BUILD PROJECT tmpPrj FROM (pPrg)
MODIFY PROJECT tmpPrj NOWAIT NOSHOW
_vfp.ActiveProject.Icon="myIcon.ico"
STRTOFILE('screen=off'+CHR(13)+CHR(10),'config.fpw')
_vfp.ActiveProject.Files.Add('config.fpw')
_vfp.ActiveProject.Close
BUILD EXE (pExe) FROM tmpPrj RECOMPILE
ERASE config.fpw
ERASE tmpPrj.pj? 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close